Re: Question about nested loop

2012-12-31 Thread Isaac Won
On Monday, December 31, 2012 6:59:34 AM UTC-6, Hans Mulder wrote: > On 31/12/12 11:02:56, Isaac Won wrote: > > > Hi all, > > > I am a very novice for Python. Currently, I am trying to read continuous > > > columns repeatedly in the form of array. > > > my code is like below: > > > > > > imp

Re: Question about nested loop

2012-12-31 Thread Isaac Won
On Monday, December 31, 2012 5:25:16 AM UTC-6, Gisle Vanem wrote: > "Isaac Won" wrote: > > > > > while c < 10: > > >c = c + 1 > > > > > >for columns in ( raw.strip().split() for raw in f ): > > > > > > > > >b.append(columns[c]) > > > > > >y =

Re: Question about nested loop

2012-12-31 Thread Hans Mulder
On 31/12/12 11:02:56, Isaac Won wrote: > Hi all, > I am a very novice for Python. Currently, I am trying to read continuous > columns repeatedly in the form of array. > my code is like below: > > import numpy as np > > b = [] > c = 4 > f = open("text.file", "r") > > while c < 10: > c =

Re: Question about nested loop

2012-12-31 Thread Gisle Vanem
"Isaac Won" wrote: while c < 10: c = c + 1 for columns in ( raw.strip().split() for raw in f ): b.append(columns[c]) y = np.array(b, float) print c, y I thought that can get the arrays of the columns[5] to [10], but I only could get repetition

Question about nested loop

2012-12-31 Thread Isaac Won
Hi all, I am a very novice for Python. Currently, I am trying to read continuous columns repeatedly in the form of array. my code is like below: import numpy as np b = [] c = 4 f = open("text.file", "r") while c < 10: c = c + 1 for columns in ( raw.strip().split() for raw