r'\' - python parser bug?
Per Erik Stendahl
berra at psyket.com
Fri May 28 08:33:02 EDT 2004
Fuzzyman wrote:
[snip]
> Yeah.. that's not an annoying feature.... I mean no-one would ever
> want to use strings to hold Windows pathnames in......
So I guess I'm not the only one who tries to use a special class for
paths as much as possible then? ;-)
Working with pathnames as strings is painful, IMHO. Using objects makes
it much clearer, for me anyway.
path = Path(r'C:\documents\my\file.txt')
if path.isfile():
shutil.copyfile(path.get(), ....)
print path.dir()
other_path = path.parent() / 'subdir' / 'otherfile' + '.txt'
...
Regards,
Per Erik Stendahl
More information about the Python-list
mailing list