N
nummertolv
Hi,
My application is receiving strings, representing windows paths, from
an external source. When using these paths, by for instance printing
them using str() (print path), the backslashes are naturally
interpreted as escape characters.
d: hedir
The solution is to use repr() instead of str():
'd:\thedir'
What I have not been able to figure out is how to handle escape
sequences like \a, \b, \f, \v and \{any number} inside the paths. Using
repr() on these escape sequences either prints the hex value of the
character (if "unprintable" i guess) or some character ( like in the
last example below).
Could someone clear this out for me and let me know how I can find the
"real" path that I am trying to receive?
/Henrik
My application is receiving strings, representing windows paths, from
an external source. When using these paths, by for instance printing
them using str() (print path), the backslashes are naturally
interpreted as escape characters.
d: hedir
The solution is to use repr() instead of str():
'd:\thedir'
What I have not been able to figure out is how to handle escape
sequences like \a, \b, \f, \v and \{any number} inside the paths. Using
repr() on these escape sequences either prints the hex value of the
character (if "unprintable" i guess) or some character ( like in the
last example below).
'd:\thedir@''d:\thedir\x08'
'd:\thedir\x0coo'
Could someone clear this out for me and let me know how I can find the
"real" path that I am trying to receive?
/Henrik