how to replace double backslash with one backslash in string...
Vincent Texier
vit at free.fr
Thu Jul 1 06:27:20 EDT 2004
Hello,
I want to send 3 chars in hexa code to the serial port.
So I type in a tkinter entry : "\x20\x01\x21"
The string is set in a StringVar().
When I read the stringVar, I get : "\\x20\\x01\\x21"
The length is 12 and not 3 anymore.
How can I replace the escape character from the string with the
corresponding char, and get my 3 char string back ?
I've tried a re.sub(r'\\', chr(92)) but chr(92) is a double backslash again.
Thanks for any help.
Vince.
More information about the Python-list
mailing list