Multimapping and string converting

Ron Brennan brennan.ron at gmail.com
Fri Sep 19 09:59:26 EDT 2008


Hello,

I have a multimap dictionary with a 1 Key to N values.  I want to convert
the N values to a string to be used elsewhere in my program.

So I have dict[(1,[1, 2 ,3 ,4])] which I have sorted

When I do a print ''.join(str(dict.value())) I get [1, 2, 3, 4] as an output
when I really want 1 2 3 4

Here is my code:

dmapItems = dictionary.items()
dmapItems.sort()

for tcKey, tcValue in dmapItems:
    file.write('Key = %s\nValue = %s" % (tcKey, tcValue)

stinger = ''.join(str(tcValue))

print stringer

The Output = [145, 2345, 567, 898]
I need it to be 145 2345 567 898


Can anyone see the errors of my ways?

Thanks,
Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080919/76f01d5d/attachment.html>


More information about the Python-list mailing list