testing true condition

Richard Chamberlain richard_chamberlain at ntlworld.com
Wed Apr 19 12:51:20 CEST 2000


You could use something like this:

file=open("test.txt","r")
for line in file.readlines():
    print line

Richard


"Gregoire Welraeds" <helpdesk at perceval.be> wrote in message
news:Pine.BSF.4.10.10004191138390.292-100000 at hercule.perceval.be...
> Hi,
>
> I know that I can't do something like the following:
>
> >>> while (line= f.readline()):
> ...
>
> as i could in C.  Is there any replacement tricks ?
> I know that I could use something with f.read() but i don't want to have
> the file completly loaded in memory
>
> Best regards,
>
> --
> Life is not fair
> But the root password helps
> --
>
> Gregoire Welraeds
> greg at perceval.be
> Perceval Development team
> --------------------------------------------------------------------------
-----
> Perceval Technologies sa/nv Tel: +32-2-6409194
> Rue Tenbosch, 9 Fax: +32-2-6403154
> B-1000 Brussels general information:   info at perceval.net
> BELGIUM technical information: helpdesk at perceval.net
> URL: http://www.perceval.be/
> --------------------------------------------------------------------------
-----
>
>





More information about the Python-list mailing list