import requests from io import BytesIO def get_img(): url = 'http://1234567890' #下载的图片的 URL img_data = requests.get(url2[1]).content 获取图片二进制字符 file_like = BytesIO(img_data) 转换类型 file_like.name = 'ls.jpg' 定义名后才能当作对象使用
return file_like
import requests from io import BytesIO def get_img(): url = 'http://1234567890' #下载的图片的 URL img_data = requests.get(url2[1]).content 获取图片二进制字符 file_like = BytesIO(img_data) 转换类型 file_like.name = 'ls.jpg' 定义名后才能当作对象使用
return file_like