Case sensitive file names

Tim Peters tim.one at comcast.net
Sun Feb 22 18:27:52 CET 2004


[Thomas Philips]
> When opening a file with file.open(filename,"r") under Windows,

I'm not sure what you mean.  There's a file() builtin and an open() builtin
(which are the same thing), but there's no module named "file", and there's
no "open" attribute on the builtin file object.

> I find that the file name is case sensitive - any error in the case
> leads to the file not being found.

I don't.  Please give an example.  Here's mine:

C:\Code>dir/b tcap*
tcap.txt

C:\Code>\python23\python
Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> open('tcap.txt')
<open file 'tcap.txt', mode 'r' at 0x006A79E0>
>>> open('TcAp.TxT')
<open file 'TcAp.TxT', mode 'r' at 0x006A7620>
>>> open('TCAP.TXT')
<open file 'TCAP.TXT', mode 'r' at 0x006A7FA0>
>>>

Case doesn't matter.  'r' is the default mode, and it's exactly the same if
I pass "r" explicitly.





More information about the Python-list mailing list