[Tutor] Commandline and backslash problem

Roeland Rengelink r.b.rigilink@chello.nl
Sun, 28 Oct 2001 18:22:45 +0100


Hi,

Are you sure this is a backslash problem

I made this little testprogram, and as far as I can tell Entry.get() is
smart about escaping the backslashes.

from Tkinter import *

def ev(*args):
    t =3D e.get()
    print t, repr(t)

e =3D Entry()
e.pack()
b =3D Button(text=3D'do', command=3Dev)
b.pack()
mainloop()


Some example output
a\b 'a\\b'
a\b\\c\t\n 'a\\b\\\\c\\t\\n'


nhytro-python@web.de wrote:
> =

> I have the "backslash" problem with an application I=B4m developing. I =
know about escaping forward slashes or using raw strings, but things are =
not working as I expect. A code snippet:
> =

> #################code -start
> =


What do you get if you replace go_render with:

def go_render():
    textfile =3D inputfile.get()
    print textfile
    editor =3D editorpath.get()
    print editor
    os.system("%s %s" % (editor, textfile))

As far as I can tell there's no need to do the string replacement

Hope this helps,

Roeland

-- =

r.b.rigilink@chello.nl

"Half of what I say is nonsense. Unfortunately I don't know which half"