Re: [Tutor] format a file

2009-02-26 Thread Kent Johnson
On Thu, Feb 26, 2009 at 4:09 AM, prasad rao wrote: > hello > I find it difficult to use horizontal scroll bar to read text documents. > So I want to split lines in the text file in to two lines. > > def  myforrmat(source,desty): > so=open(source) > de=open(desty,'w') > for line in

Re: [Tutor] format a file

2009-02-26 Thread Lie Ryan
Try thinking what happens when you do this: line = 'this is a rellly long line\n' first = line[:20] second = line[20:] print first print second . . . . . . . . . . Have you got it? The first would contain "this is a re" and the second "llly long linee

[Tutor] format a file

2009-02-26 Thread prasad rao
hello I find it difficult to use horizontal scroll bar to read text documents. So I want to split lines in the text file in to two lines. def myforrmat(source,desty): so=open(source) de=open(desty,'w') for line in so: ? if len(line)<60:de.write(line) ? if len(line)