[Tutor] re.format a file
Kent Johnson
kent37 at tds.net
Thu Feb 26 16:06:22 CET 2009
On Thu, Feb 26, 2009 at 8:43 AM, prasad rao <prasadaraon50 at gmail.com> wrote:
> hello
> Thank 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
No need for the above line, it does nothing.
Kent
> ???if len(line)>60:
> ??????line=line[:60]+'\n'+line[60:]
> Is it the right way to do?
> Thank you
> Prasad
More information about the Tutor
mailing list