newb loop problem
Dave
NunezD at gmail.com
Tue Aug 12 23:46:47 EDT 2008
Hey there, having a bit of problem iterating through lists before i go
on any further, here is
a snip of the script.
--
d = "a1 b1 c1 d1 e1 a2 b2 c2 d2 e2 a3 b3 c3 d3 e3 a4 b4 c4 d4 e4 a5 b5
c5 d5 e5"
inLst = d.split()
hitLst = []
hitNum = 0
stopCnt = 6 + hitNum
for i in range(hitNum,len(inLst), 1):
if i == stopCnt: break
hitLst.append(inLst[i])
print hitLst
--
$ python helper.py
['a1', 'b1', 'c1', 'd1', 'e1', 'a2']
This works fine for my purposes, what I need is an outer loop that
goes through the original list again and appends my next request.
ie.
hitNum = 5
which will return:
['a2', 'b2', 'c2', 'd2', 'e2', 'a3']
and append it to the previous one.
ie:
['a1', 'b1', 'c1', 'd1', 'e1', 'a2']
['a2', 'b2', 'c2', 'd2', 'e2', 'a3']
not really sure how to do this right now though, been trying several
methods with no good results.
btw, just creating lagged values (sort of shift registers) on the
incoming signal
Many thanks,
Dave
More information about the Python-list
mailing list