L
lee
hi,
rfids= ['01','02']
i = 01
row = {}
items = []
for rfid in rfids:
brains = ['1','2']
if brains:
for brain in brains:
# this loop must run only once for each value of i
row['itemnos'] = 'item_0'+str(i)+'s'
print 'hi'
items.append(row)
print items
break
i=i+1
the above code produces output a:
[{'itemnos': 'item_02s'}, {'itemnos': 'item_02s'}]
but i want it to be,
[{'itemnos': 'item_01s'}, {'itemnos': 'item_02s'}]
can anyone point wer am erroring.
Thanks in advance.
rfids= ['01','02']
i = 01
row = {}
items = []
for rfid in rfids:
brains = ['1','2']
if brains:
for brain in brains:
# this loop must run only once for each value of i
row['itemnos'] = 'item_0'+str(i)+'s'
print 'hi'
items.append(row)
print items
break
i=i+1
the above code produces output a:
[{'itemnos': 'item_02s'}, {'itemnos': 'item_02s'}]
but i want it to be,
[{'itemnos': 'item_01s'}, {'itemnos': 'item_02s'}]
can anyone point wer am erroring.
Thanks in advance.