Python in Windows -


I'm new to Python and need some help.

I have to write a script that will appear with the ext ".dat" in the c: \ script \ test \ directory for the file and find "^" and "|"

I'm not sure how to write it. As a file name, the current date directory will contain only one file for one day.

Please help. I'm not clearly a good programmer

thanks

  import File name in Glob.glob ("C: \ script \ test \ * .dat"): Open (file name, 'rb') as input file as: data = inputfile.read () open (file name , 'Wb') as outputfile: outputfile.write (data.replace ("^", "|"))  

should work in Python 2.6 and 2.7. Make sure that you first back up your file.


Comments