Python how to handle # in a dictionary
- by Jack
I've got some json from last.fm's api which I've serialised into a dictionary using simplejson. A quick example of the basic structure is below.
{ "artist":
"similar": {
"artist": {
"name": "Blah",
"image": {"#text":"URLHERE","size": "small"}
"image": {"#text":"URLHERE","size": "medium"}
"image": {"#text":"URLHERE","size": "large"}
}
}
}
Any ideas how I can access the image urls of various different sizes. My attempts at accessing the #text variable don't seem to work because python doesn't appear to like #'s in the names. And any ideas how I can easily get the url for the depending on the size?
Thanks,
Jack