[Tutor] deleting CR within files

David Talaga dtalaga at novodynamics.com
Thu Apr 15 09:38:04 EDT 2004


Hi all!
Here is my next problem.  I am trying to rid some files of pesky <CR> from
files.  Here is my code.  Any help would be great!


import re, os, dialog #dialog is a dialog box function

sub = re.sub

fileName = dialog

in_file = open(fileName,'r') #I open the file for reading
out_file = open(fileName + '_cleaned', 'w') #I opne the file and rename it
as filename_cleaned.
for i in in_file.readlines():  I thikn you get the rest
    tmp = sub('\x0D','', i)
    out_file.write(tmp)
in_file.close()
out_file.close()


David Talaga
dtalaga at novodynamics.com
734-205-9127




More information about the Tutor mailing list