Last active
March 5, 2020 02:23
-
-
Save geekgogo/21e30a95c5a5f80b86151fc0b076a83a to your computer and use it in GitHub Desktop.
利用PIL保存url图片
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import requests | |
from io import BytesIO | |
def download(url, name): | |
ret = requests.get(url) | |
image = Image.open(BytesIO(ret.content)) | |
image.save(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment