Re: problem with special characters in filename

2009-01-23 Thread Diez B. Roggisch
The above at least applies to Linux. I'm not sure about windows - I *know* they have wide-char/unicode support, but I'm not sure how exactly that is exposed via the python file apis Just found this: http://www.amk.ca/python/howto/unicode there is a seciton about filenames and OSes in there

Re: problem with special characters in filename

2009-01-23 Thread Diez B. Roggisch
fizzo...@gmail.com schrieb: using: Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Hello I have two files (let's assume they are all in the same directory): 1) "a.dat" containing the single line "Sébastien.dat" 2) "Sébastien.dat" containing arbi

Re: problem with special characters in filename

2009-01-23 Thread Murali Murali
Try this: import shutil,os file1 = open('a.dat','r') #opens file for reading for line in file1: print line ##old_name = line[0:len(line)-1] #gets rid of "\n" suffix ##print old_name line.strip() #gets rid of "\n" suffix print line os.rename('b.dat',line) #renames file file1.cl