write to a file two dict()
giuseppe.amatulli at gmail.com
giuseppe.amatulli at gmail.com
Sun Sep 23 13:44:30 EDT 2012
Hi
Have two dict() of the same length and i want print them to a common file.
a={1: 1, 2: 2, 3: 3}
b={1: 11, 2: 22, 3: 33}
in order to obtain
1 1 1 11
2 2 2 22
3 3 3 33
I tried
output = open(dst_file, "w")
for (a), b , (c) , d in a.items() , b.items() :
output.write("%i %i %i %i\n" % (a,b,c,d))
output.close()
but i get the error ValueError: need more than 3 values to unpack.
do you have some suggestions?.
Thanks
Giuseppe
More information about the Python-list
mailing list