Re: stripping spaces in front of line

2006-03-04 Thread Peter Otten
[EMAIL PROTECTED] wrote: > f = open("textfile","rU") > while (1): > line = f.readline().strip() > if line == '': > break > print line > f.close() Be warned that your code doesn't read the whole file if that file contains lines with only whitespace character

Re: stripping spaces in front of line

2006-03-04 Thread Steve Holden
[EMAIL PROTECTED] wrote: > hi > wish to ask a qns on strip > i wish to strip all spaces in front of a line (in text file) > > f = open("textfile","rU") > while (1): > line = f.readline().strip() > if line == '': > break > print line > f.close() > > in "text

Re: stripping spaces in front of line

2006-03-03 Thread Steven D'Aprano
On Fri, 03 Mar 2006 20:01:30 -0800, eight02645999 wrote: > hi > wish to ask a qns on strip > i wish to strip all spaces in front of a line (in text file) > > f = open("textfile","rU") > while (1): > line = f.readline().strip() > if line == '': > break > pri

Re: stripping spaces in front of line

2006-03-03 Thread Jorge Godoy
[EMAIL PROTECTED] writes: > hi > wish to ask a qns on strip > i wish to strip all spaces in front of a line (in text file) > > f = open("textfile","rU") > while (1): > line = f.readline().strip() > if line == '': > break > print line > f.close() > > in "text

Re: stripping spaces in front of line

2006-03-03 Thread James Stroud
[EMAIL PROTECTED] wrote: > hi > wish to ask a qns on strip > i wish to strip all spaces in front of a line (in text file) > > f = open("textfile","rU") > while (1): > line = f.readline().strip() > if line == '': > break > print line > f.close() > > in "text

Re: stripping spaces in front of line

2006-03-03 Thread Tim Chase
> wish to ask a qns on strip > i wish to strip all spaces in front of a line (in text file) > > f = open("textfile","rU") > while (1): > line = f.readline().strip() > if line == '': > break > print line > f.close() Yes, that would be a way to do it. > in "

stripping spaces in front of line

2006-03-03 Thread eight02645999
hi wish to ask a qns on strip i wish to strip all spaces in front of a line (in text file) f = open("textfile","rU") while (1): line = f.readline().strip() if line == '': break print line f.close() in "textfile", i added some spaces in and then ran the code