how to replace double backslash with one backslash in string...
vit at free.fr
Thu Jul 1 15:03:27 CEST 2004
Thanks for all, it works !
I will test the presence of quotes to be safe...
Eric Brunel wrote:
> If you're sure you'll never have any quote in the string, you can try to
> do eval("'%s'" % myStringVar.get())
> >>> s = r'\x20\x01\x21'
> >>> s
> >>> eval("'%s'" % s)
> ' \x01!'
> Note that this may be dangerous, since the eval will take place in your
> program, so it can break things if you're not careful. Checking that it
> does not contain any quotes may be a good start.
More information about the Python-list