[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
[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
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
[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
[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
> 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 "
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