Bryan Fodness wrote:
> 
> Is there an easy way that an input can be upper or lower case?
> 
> The file name is TEST.TXT, and I get.
> 
> -------------------------------------------------------------------------
> 
> Enter File (if not local, enter path):    test.txt
> 
> Traceback (most recent call last):
>   File "test.py", line 52, in <module>
>     for line in open(file) :
> IOError: [Errno 2] No such file or directory: 'test.txt'
> 
> -------------------------------------------------------------------------
> 
> This is a non-issue on Windows, but now I have migrated to Ubuntu.

File names in the Windows file system are not case sensitive; in Linux 
they are. In Linux you can actually have two different files called 
test.txt and TEST.TXT:
[EMAIL PROTECTED] py]$ cat > test.txt
this is a test
[EMAIL PROTECTED] py]$ cat > TEST.TXT
THIS IS ANOTHER TEST
[EMAIL PROTECTED] py]$ cat test.txt
this is a test
[EMAIL PROTECTED] py]$ cat TEST.TXT
THIS IS ANOTHER TEST

Probably the best solution is to get used to it :-) but you could check 
for other files in the dir whose name matches ignoring case and open 
that file if there is a unique match.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to