parse this directory path without losing slash
Posted
by PPTim
on Stack Overflow
See other posts from Stack Overflow
or by PPTim
Published on 2010-05-18T19:04:03Z
Indexed on
2010/05/18
21:00 UTC
Read the original article
Hit count: 209
hi,
I have a wxPython application. I am taking in a directory path from a textbox using GetValue().
I notice that while trying to parse in the directory path
"C:\Documents and Settings\UserName\Desktop\InputFile.xls"
,
python sees the string as
'C:\\Documents and Settings\UserName\\Desktop\\InputFile.xls'
(missing a slash between "Settings" and "UserName).
Why is it that only that slash is not correctly escaped? Once the string has been changed to 'C:\Documents and Settings\UserName\Desktop\InputFile.xls', is there a type conversion or function that can does this properly? Thanks.
© Stack Overflow or respective owner