On 08/09/2012 10:11 PM, giuseppe.amatu...@gmail.com wrote:
Hi,
I have a dict() unique
like this
{(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2}
and i want to print to a file without the brackets comas and semicolon in order 
to obtain something like this?
4 5 1
5 4 1
4 4 2
2 3 1
4 3 2
Any ideas?
Thanks in advance
Giuseppe

Boring explicit solution:

d = {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2}
for key, val in d.items():
    v1,v2 = key
    fout.write("%d %d %d\n" % (v1, v2, val))


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to