我在Python中使用bing圖像搜索api,它返回一個json對象,其中包含圖像的url。我想在網頁瀏覽器中將該網址打印爲縮略圖或圖像?我該怎麼做?如何在Web瀏覽器中顯示JSON對象的圖像?
req = urllib2.Request(url, {}, headers)
response = urllib2.urlopen(req)
the_page = response.read()
print the_page
JSON還給我一些輸出這樣的事......
"hostPageUrl": "http:\/\/www.bing.com\/cr? IG=0644661E90174FF0944669467BB395AC&CID=138A535946A560B83BE859564794619A&rd=1&h=13FbTtiOoEUhU2CsArQ07IbXxNhi-nNDQ6fPq7MWTQU&v=1&r=http%3a%2f%2fwww.wsllpaper.com%2fmunchkin-cat-pictures-hd-desktop-wallpaper.html&p=DevEx,5091.1", "contentSize": "519962 B", "encodingFormat": "jpeg", "hostPageDisplayUrl": "www.wsllpaper.com\/munchkin-cat-pictures-hd-desktop-wallpaper.html", "width": 2048, "height": 1536, "thumbnail": {"width": 300, "height": 225}, "imageInsightsToken": "ccid_RKtlG1SO*mid_4EB4BDF5CB93430D44C13AB68064BC296B6593BE*simid_608043795625871665", "imageId": "4EB4BDF5CB93430D44C13AB68064BC296B6593BE", "accentColor": "496A82"},
可以請您發佈json結構 –
發佈您的代碼 – shas
您的意思是整體輸出嗎? – user7441079