Re: file data to list

2008-08-29 Thread Sion Arrowsmith
Emile van Sebille [EMAIL PROTECTED] wrote: data = zip(*[xx.split() for xx in open('data.txt').read().split(\n)]) Files are iterable: data = zip(*[xx.rstrip().split() for xx in open('data.txt')]) saves you creating the extra intermediate list resulting from split(\n). -- \S -- [EMAIL

file data to list

2008-08-28 Thread Anish Chapagain
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

Re: file data to list

2008-08-28 Thread bearophileHUGS
Anish Chapagain: 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. This may offer you a starting point: line = cnt0003a 31250

Re: file data to list

2008-08-28 Thread Marc 'BlackJack' Rintsch
On Thu, 28 Aug 2008 12:11:39 -0700, Anish Chapagain wrote: 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

Re: file data to list

2008-08-28 Thread Emile van Sebille
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