[Tutor] deleting CR within files

David Talaga dtalaga at novodynamics.com
Mon Apr 19 09:57:47 EDT 2004

Is there such a thing as a do loop in Python?  Like, do this until this is
done.  In my program I have a simple widget and need to initiate it before
my dialog pops up.  And then give the user the option to select more files
with the same widget.  I know that I need to use some kind of loop and in VB
a do loop would work best.  But what about in Python?

David Talaga

-----Original Message-----
From: Alan Gauld [mailto:alan.gauld at blueyonder.co.uk]
Sent: Saturday, April 17, 2004 3:47 PM
To: David Talaga; Roger Merchberger; tutor at python.org
Subject: Re: [Tutor] deleting CR within files

> for i in in_file:
>       out_file.write(i[:])
> This does what I need with the excpetion that it dosent do it for
> 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())


Alan G

More information about the Tutor mailing list