访问网站:

http://placekitten.com/g/200/300

就可以得到一只猫的照片

用Python下载一只猫

你可以使用右键图片另存为将其保存到本地

现在用Python来实现


import urllib.request

response = urllib.request.urlopen("http://placekitten.com/g/200/300")
cat_img = response.read()

with open('cat_200_300.jpg', 'wb') as f:
    f.write(cat_img)


运行,在代码所在的文件夹出现了cat_200_300.jpg 

相关文章:

  • 2021-07-31
  • 2021-06-10
  • 2021-04-07
  • 2021-08-20
  • 2021-10-22
  • 2021-04-15
  • 2021-11-19
  • 2021-12-02
猜你喜欢
  • 2021-11-27
  • 2021-06-04
  • 2022-01-04
  • 2021-09-18
  • 2022-01-08
  • 2021-12-23
  • 2022-12-23
相关资源
相似解决方案