# combine the lists
zipped = zip(alist, blist)
# write to a file (in append mode)
file = open("filename", 'a')
for item in zipped:
file.write("%d, %d\n" % item)
file.close()
1,2
2,3
3,4
5,5
在Python中合并2个列表
# combine the lists
zipped = zip(alist, blist)
# write to a file (in append mode)
file = open("filename", 'a')
for item in zipped:
file.write("%d, %d\n" % item)
file.close()
1,2
2,3
3,4
5,5