windows / unix path
Larry Bates
larry.bates at vitalEsafe.com
Mon Oct 20 11:47:01 EDT 2008
Marcin201 wrote:
> Is there an built-in functionality in python to convert Windows paths
> to Unix paths? I am running into problems when creating data files on
> Windows and the running them on a Unix platform. I create paths using
> os.path.join.
>
> os.path.join('Pictures', '01.jpg') returns 'Pictures\\01..jpg' on
> Win. When I read files created on Win under Unix this is a problem,
> python cannot open 'Pictures\\01.jpg'
>
> Thanks,
>
> Marcin
I use posixpath when I want to "force" forward slashes that I know will work on
Linux. Actually the forward slashes work fine on Windows also (undocumented
feature of Windows).
-Larry
More information about the Python-list
mailing list