NEWbie asks "is Python a good tool for automated file/folder generation?"
peter at engcorp.com
Wed Jun 19 02:44:47 CEST 2002
Chris Barker wrote:
> Peter Hansen wrote:
> > Better to learn to use raw-strings, with an "r" in front,
> > as in path = r"c:\this is a safe path" or better yet,
> > either forward slashes always: path = "c:/this works too".
> Or even better, use os.path.join(), you never know when you will
> encounter a Mac. (of course, if it's OSX, the above will work as well)
I started writing that, then went to the interactive prompt
and concluded (after brief experimentation) that there was
no way to join the "c:" and the "this works too" portions
of the path without explicitly specifying a "/" to force it
to be an absolute path. Doubtless I did something wrong,
but I decided to avoid the issue by skipping any mention of
Of course, since drive letters are not portable anyway this
is all a moot point. For any hardcoded path like that,
you can't have a very good cross-platform solution I suppose.
More information about the Python-list