Windows vs. Linux

James Stroud jstroud at mbi.ucla.edu
Mon Jul 31 15:38:50 EDT 2006


jean-michel bain-cornu wrote:
>Take care to use os.sep

This is an important point. You should read up on the os.path module to 
make sure you are doing things in a platform independent way, for 
example, its better to use:

   os.path.join('my', 'favorite', 'dir')

than

   "\\".join(['my', 'favorite', 'dir'])

because the latter will bonk on linux. The former is platform 
independent. This hits at the same issue as using os.sep:

   os.sep.join(['my', 'favorite', 'dir'])

But os.path has takes care of many of these issues in one module.

James

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/



More information about the Python-list mailing list