Skip to content

Instantly share code, notes, and snippets.

@baobao
Created November 3, 2017 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baobao/f9881eb9e012a42b676ab6411c9b3b98 to your computer and use it in GitHub Desktop.
Save baobao/f9881eb9e012a42b676ab6411c9b3b98 to your computer and use it in GitHub Desktop.
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