Issue1745533
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2007-06-29 21:05 by atagar, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (5) | |||
---|---|---|---|
msg32426 - (view) | Author: Damian (atagar) | Date: 2007-06-29 21:05 | |
The help section for the open method should note that a Unix style filename work in a cross platform fashion (like Java). After scouring several resources including two O'Reilly texts on Python, a dozen web pages, all reliant help pages, I finally got my answer from a mailing list. -Damian |
|||
msg32427 - (view) | Author: Senthil Kumaran (orsenthil) * | Date: 2007-06-30 12:24 | |
I am not getting as what you are indicating Damian. You mean to say use '/' forward slashes in all documentation as they can work cross platform? |
|||
msg32428 - (view) | Author: Damian (atagar) | Date: 2007-06-30 21:38 | |
No, I'm talking about the documentation when entering help(file) or help(open). The filename parameter works in a cross platform fashion when given a Unix path. For instance, file = open("/path/to/content.xml", "r") # Cross platform file = open("\\path\\to\\content.xml", "r") # Win32 only This seemed to be an undocumented yet important detail (unless I'm mistaken it means its advantageous to always use the former method when coding paths). However, looking around some more I think this is largely a misunderstanding on my part in terms of where the cross platform capability came from (Windows accepting a forward slash rather than the open method translating the path for the current OS). Sorry about the confusion. |
|||
msg32429 - (view) | Author: Damian (atagar) | Date: 2007-06-30 21:48 | |
No, I'm talking about the documentation when entering help(file) or help(open). The filename parameter works in a cross platform fashion when given a Unix path. For instance, file = open("/path/to/content.xml", "r") # Cross platform file = open("\\path\\to\\content.xml", "r") # Win32 only This seemed to be an undocumented yet important detail (unless I'm mistaken it means its advantageous to always use the former method when coding paths). However, looking around some more I think this is largely a misunderstanding on my part in terms of where the cross platform capability came from (Windows accepting a forward slash rather than the open method translating the path for the current OS). Sorry about the confusion. |
|||
msg32430 - (view) | Author: Martin v. Löwis (loewis) * | Date: 2007-07-01 08:34 | |
I think that's what Damian says, but it's partially wrong. Python has not taken any specific effort to make / work on all systems; it just happens to work on Windows as well. However, it does so only in a limited manner: you still might need to specify drive letters, and you cannot easily pass a file name with forward slashes to an external program, as that may mistake the slashes as command line options. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:25 | admin | set | github: 45141 |
2007-06-29 21:05:53 | atagar | create |