Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29830
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2012-09-23 10:44 -0700 |
| Message-ID | <d0910f3d-5c9d-4c0f-8f3d-20ac394c2f45@googlegroups.com> (permalink) |
| Subject | write to a file two dict() |
| From | giuseppe.amatulli@gmail.com |
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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
write to a file two dict() giuseppe.amatulli@gmail.com - 2012-09-23 10:44 -0700 Re: write to a file two dict() MRAB <python@mrabarnett.plus.com> - 2012-09-23 19:00 +0100 Re: write to a file two dict() 88888 Dihedral <dihedral88888@googlemail.com> - 2012-09-23 13:34 -0700
csiph-web