"Neven Gorsic" <neven.gor...@gmail.com> wrote
When I get file path from DirDialog, I get in a (path) variable.
Sometimes that string (path) contains special escape sequences, such as \x,
\r and so on.
'C:\Python25\Programs\rating'
When I try to open that file (whose name contains escape sequences) it
doesn't work.
That sounds like a bug in DirDialog since I would expect it to return a
properly constructed, platform specific path! Are you sure it doesn't?
What is the len() of the string? The above should return 27 not 24...
I know that raw string marker 'r' in front of string leaves char '\' as
character and not as start of escape sequences,
but I can not apply it to a variable name which contains file path.
You can only apply it to literal strings not variables , regardless of
what the variable points to.
Is there a function with same effect as raw string marker, as my problem
must be solved differently?
You might get some help from the os.path library functions. But to be
honest I can't see anything obvious... You might have to resort to
character by character replacement...
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor