[Tutor] re.format a file
prasad rao
prasadaraon50 at gmail.com
Thu Feb 26 14:43:59 CET 2009
helloThank you Lie and Kent.
I forgot about newline character and the fact that string can be sliced.
Thanks for your timely help
BTW I have gone through the Python library reference and find no examples
in fileinput module.
z=fileinput.input(file,inplace=1)
for line in z:
???if len(line)<60:pass
???if len(line)>60:
??????line=line[:60]+'\n'+line[60:]
Is it the right way to do?
Thank you
Prasad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090226/2e6ec6e5/attachment.htm>
More information about the Tutor
mailing list