The format of filename

Tim Chase python.list at
Tue Oct 24 17:29:08 CEST 2006

>> As an example, I'm aware (through osmosis?) that I can use '/' as
>> a directory separator in filenames on both Unix and Dos. But
>> where is this documented?
> in the documentation for your operating system.  Python doesn't do 
> anything with the filenames.

Windows seems to be (occasionally) doing the translation as /F 

C:\temp> python
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more 
 >>> for line in file('subdir/test.txt'):
...	print line.strip()
 >>> ^Z

C:\temp> REM try the same filename convention from dos prompt
C:\temp> type subdir/test.txt
The syntax of the command is incorrect.
C:\temp> REM try with quotes, just in case...
C:\temp> type "subdir/test.txt"
The syntax of the command is incorrect.
C:\temp> notepad subdir/test.txt
C:\temp> REM correctly opened the text file in notepad

Windows seems to doing the translation inconsistently (I know 
that comes as a shock...)


More information about the Python-list mailing list