[Tutor] deleting CR within files

Alan Gauld alan.gauld at blueyonder.co.uk
Sat Apr 17 15:47:27 EDT 2004


> for i in in_file:
>       out_file.write(i[:])
>
> This does what I need with the excpetion that it dosent do it for
every
> line.  It is currous because it will take off a <cr> from one line
and not
> the next 2 and then from another line...  currious...

Are you sure thats not the origoinal data?

Try using the strip function since it will only strip off if there
is anything to strip so should work in all cases.

ie.   out_file.write(i.strip())

HTH,

Alan G





More information about the Tutor mailing list