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

Ryan Gonzalez rymg19 at gmail.com
Wed Oct 30 23:58:14 CET 2013


1.Python 3 doesn't come with Ubuntu
2.I still get irritated by that darn print statement
3.Everything I've written is for Python 2. I'm too lazy to port right now

Plus:




On Wed, Oct 30, 2013 at 5:50 PM, Guido van Rossum <guido at python.org> wrote:

> No, nothing's wrong. You should use the ntpath module in this case.
>
> You should also be using Python 3. :-)
>
> $ python3
> Python 3.4.0a4+ (default:0917f6c62c62, Oct 22 2013, 10:55:35)
> [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
>
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import ntpath
> >>> ntpath.join('C:\\', 'x.jpg')
> 'C:\\x.jpg'
> >>>
>
>
>
> On Wed, Oct 30, 2013 at 3:35 PM, Ryan Gonzalez <rymg19 at gmail.com> wrote:
>
>> 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
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>>
>>
>
>
> --
> --Guido van Rossum (python.org/~guido)
>



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


More information about the Python-ideas mailing list