Need help on reading line from file into list

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Wed Apr 4 06:47:46 EDT 2007


bearophileHUGS at lycos.com a écrit :
> Bruno Desthuilliers:
>> result = [line.strip() for line in f.readlines()]
> 
> Probably better, lazily:
> result = [line.strip() for line in infile]

This is of course better in the general case, but I wanted to stay 
consistant with the other examples...




More information about the Python-list mailing list