Skip to content

Instantly share code, notes, and snippets.

@baobao
Created Nov 3, 2017
Embed
What would you like to do?
import urllib.request
url = "https://cdn-ak.f.st-hatena.com/images/fotolife/e/esakun/20150730/20150730215258.gif"
savename = "test.png"
memory = urllib.request.urlopen(url).read();
# w・・・書き込み
# b・・・バイナリ
# wbとはバイナリ書き込みを意味する
with open(savename, mode="wb") as f:
f.write(memory)
print("save complete")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment