Phoe6 a écrit :
> Hi all,
> I just read the manual and got to know I can use a for loop to iterate
> through the lines in the file.
>
> But so far, I was strugling with the following:
>
> import os
> file = open('File1.txt','r')
'file' is the builtin type for file objects (like the one returned
Thomas Girod wrote:
>
> while line != "":
>
> and it works very well.
Thanks Thomas, I stand corrected now.
my mistake, I was checking against a single space ' ' instead of empty
string ''. :(
--
Senthil
--
http://mail.python.org/mailman/listinfo/python-list
If your code is exactly what you've copy-pasted, then you are not
testing against an empty string but a "one blank space" string ...
I've just tried with :
while line != "":
and it works very well.
--
http://mail.python.org/mailman/listinfo/python-list