When e.g. q == tags
, your print
line becomes:
print "tags" + ': ' + [{"id":"1","name":"Downhill"}]
Python is strongly typed, so you can't implicitly concatenate a (unicode) string with a list. You need to be explicit about what you want to happen, i.e. that the list (data[q]
) should be converted to a string:
print q + ': ' str(data[q])
or, much better, use str.format
rather than string concatenation (or the old-fashioned %
formatting):
print "{0}: {1}".format(q, data[q])