AIR

#1. 爬取图片
import requests

https://zhumu.com/static/img/zhumu_logo_left.png

resp=requests.get(“https://zhumu.com/static/img/zhumu_logo_left.png")
#print( resp.content ) #字节数组 text

from PIL import Image
from io import BytesIO

buffer=BytesIO( resp.content ) #将字节数组存入内存
image=Image.open(buffer)
print( image )

#演示
import matplotlib.pyplot as plt #绘图
plt.imshow( image )

爬取结果:runfile(‘E:/文化/文件/untitled1.py’, wdir=’E:/文化/文件’)
<PIL.PngImagePlugin.PngImageFile image mode=P size=352x146 at 0x1EC82046F28>

image-20200314204322497


 Comments


Blog content follows the Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) License

Use Material X as theme , total visits times .
载入天数...载入时分秒...