Suggestion for os.path.join
David Morgenthaler
boogiemorg at aol.com
Fri May 25 02:12:35 EDT 2001
>
> You really don't want platform-independence if you want '/' regardless of
> platform: you want Unix paths, period. So don't use os.path.join, use the
> Unix flavor of join instead:
>
> >>> PATH = 'D:/SARCrates/SARBoxResults'
> >>> import posixpath
> >>> outfile = posixpath.join(PATH, "subdir", "outfile.PNG")
> >>> print outfile
> D:/SARCrates/SARBoxResults/subdir/outfile.PNG
> >>>
>
> It would be an abomination to make os.path.join pretend every system is Unix
> (or Windows, or Mac, or ...).
Thank you! This is what I was looking for.
David
More information about the Python-list
mailing list