0

my code is something like

#!/usr/bin/python
x={22025: ['abc'], 22026: ['efg', 'xyz']}
c={}
z=[]
for k,v in x.items():
   for i in v:
       c['test_suite']=i
       c['barcode']=k
       z.append(c)
print z 

the out put is

[{'test_suite': 'xyz', 'barcode': 22026}, {'test_suite': 'xyz', 'barcode': 22026}, {'test_suite': 'xyz', 'barcode': 22026}]

but I would expect it to be

[{'test_suite': 'abc', 'barcode': 22025},{'test_suite': 'efg', 'barcode': 22026},{'test_suite': 'xyz', 'barcode': 22026}]
Paul
  • 1
  • 1

0 Answers0