[Tutor] Files and file attributes
Thu, 22 Feb 2001 17:06:37 -0500
> f = open("c:/tmp/testfile","r+")
> Windows is perfectly ok with forward slashes. They keep it a
> bit of a secret though...
> is this a "Windows" feature or a Python induced platform specific
Python never does any translation of path strings on any platform, unless
you explicitly invoke functions like os.path.normpath(). All of the native
Windows API calls, and all the C libraries under Windows, accept forward or
backward slashes (or mixtures). The DOS shell (command.com on Win9X,
cmd.exe on NT/2000) is what insists on backslashes, becase it uses forward
slashes to mark command arguments. Note, though, that Python's os.system()
passes its argument to a newly-created DOS shell on Windows, so pathnames in
that do need to use backslashes.
consistency-is-overrated<wink>-ly y'rs - tim