regex - I need to remove the date -
I have to enter regex in an area which only recognizes a different date
all the files have the same Format: name.y% .m% .d% .blahblahblah
This is an example of what the file name will look like:
LordOfTheRings.14.6.28. Twin.Towers
Assume that we have a file x
.
f = open (x, 'r') data = f.read () import again y = re.sub (r ". \ D {2,4}. \ D {1 (2). \ D {1,2}. "," - ", x) New = open (y, 'w') new.write (data)
delete all After the old file
Comments
Post a Comment