[Python-ideas] Support os.path.join for Windows paths on Posix

Ryan Gonzalez rymg19 at gmail.com
Wed Oct 30 23:35:57 CET 2013


The recent thread/post/whatever on os.path.join has gotten me thinking. Say
I wanted to join a Windows path...on Ubuntu. This is what I get:

ryan at DevPC-LX:~$ python
Python 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.join('C:\\', 'x.jpg')
'C:\\/x.jpg'
>>>

Isn't something wrong there? My idea: check for \'s in the path. If there
are any, assume \ is the path separator, not /.

-- 
Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131030/03c694bf/attachment.html>


More information about the Python-ideas mailing list