[Pythonmac-SIG] about this x-platform stuff...
Richard Gordon
richard@richardgordon.net
Sat, 14 Apr 2001 13:44:41 -0400
I have been following the thread about line endings with some
interest and wanted to ask about a companion issue that I fight with
on a regular basis- path separators for different platforms.
Is there a generally accepted approach for adjusting these on the fly
in python (i.e., I write a script on Mac and then try to run it on
unix where it craps out because of the use of : rather than / as a
separator)? It seems like the perl approach was to use some variable
and actually write the script with this:
infile = 'thisdir'.theSep.'thatdir'.theSep.'otherdir'.theSep.'myfile';
The script would at some point test for OS and set the variable to /,
\ or : according to the results and, in theory, you never had to
worry about it aside from the fact that the code was even more
illegible than usual.
Is there a more elegant way to deal with this in python? Thanks.
Richard Gordon
--------------------
Gordon Design
Web Design/Database Development
http://www.richardgordon.net