[Tutor] re Format a file
Alan Gauld
alan.gauld at btinternet.com
Fri Feb 27 12:53:41 CET 2009
"prasad rao" <prasadaraon50 at gmail.com> wrote
> ???? for line in so:
> ???????? if len(line)<70:de.write(line+'\n')
> ???????? if len(line)>70:
> ???????????? da=textwrap.fill(line,width=60)
> ???????????? de.write(da+'\n')
What happens if the line is exactly 70 characters long?
I think you want an else instead of the second if....
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list