samedi 3 janvier 2015

Replacing filename [Python]


Vote count:

0




I have files that begin with Feb and I need them to be 02 instead of Feb. So far, my code is:



folder = '/Users/me/Documents/path'

import glob, os
for filename in glob.glob(folder+'/Feb*'):
os.rename(filename, filename.replace('Feb','02'))


But this isn't working and is saying there is no file or directory in the last line. All of the files in folder look something like "Feb_01_2013_05_02_53_AM.txt" with different numbers.



asked 13 secs ago







Replacing filename [Python]

Aucun commentaire:

Enregistrer un commentaire