Anish Chapagain wrote:
Hi!!
I am facing problem for extracting file data to the list so as to have
graph plotted through list.
my file(eg: data.txt) is having data like this,
cnt0001a 29000 xretya 01
cnt0002a 29850 brishal 02
cnt0003a 31250 kristal 03
from here, I need to copy data 29000, 29850, 31250 into a single list
and
01, 02, 03 to another so as to plot graph using these value.
data = zip(*[xx.split() for xx in open('data.txt').read().split("\n")])
...assuming newline separators...
...and only 'cuz I like this about zip...
Emile
--
http://mail.python.org/mailman/listinfo/python-list