I would like to write lines in a txt file with a multiple of input list.This is what I wrote to write line in my txt file:
for line in pg:
for key,value in line.items():
if key == 'name':
name.append(value)
elif key == 'age':
age.append(value)
elif key == 'address':
address.append(value)
with open('sampel.list',mode='w') as f:
f.write('name:{n},age:{a},address:{d}\n'.format(n=name,a=age,d=address))
The output that I want is:
name:paulina,age:19,address:NY
name:smith,age:15,address:AU
.
.
.
But my output is
name:[paulina,smith,...],age:[19,15,...],address:[NY,AU,...]