我在python中使用bing图像搜索api,它返回一个json对象,其中包含图像的url。我想在网络浏览器中将这些网址打印为缩略图或图片?我该怎么办?
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"},
答案 0 :(得分:0)
根据你的问题我假设你需要一个前端部分。 要在Web浏览器中执行,您需要一个html标签img src ="" ALT ="&#34 ;. src几乎是图像所在的URL。您可以访问http://www.w3schools.com/html/html_images.asp