appending into a list
c james
cjames at callone.net
Tue Oct 30 08:28:33 EDT 2007
Beema shafreen wrote:
> 2721520 2721569 A_16_P21360235 199 -49
> 2721768 2721821 A_16_P03641971 139 -53
> 2721960 2722004 A_16_P21360237 312 -44
> I need to append the column D and E into a list:
> in such a way that the list should have
> [D,E,D,E,D,E........]
> How do i do it.
>
> regards
> shafreen
Without a header, you could use something like
data = [x.split()[-2:] for x in open(filename).readlines()]
With header
f = open(filename)
f.readline()
data = [x.split()[-2:] for x in f.readlines()]
More information about the Python-list
mailing list