Populating a list

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Mon Dec 10 04:41:21 EST 2001


Sun, 9 Dec 2001 23:44:55 +0100, Alex Martelli <aleaxit at yahoo.com> pisze:

> states = [ line[:-1] for line in f.readlines() ]

It will have undesirable effect when the last line of the file doesn't
end with '\n'.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^
QRCZAK



More information about the Python-list mailing list