Skip to content

Instantly share code, notes, and snippets.

@ColtonPhillips
Created June 21, 2018 06:12
Show Gist options
  • Save ColtonPhillips/3f2a0ed4a716957e25274cca03c735ac to your computer and use it in GitHub Desktop.
Save ColtonPhillips/3f2a0ed4a716957e25274cca03c735ac to your computer and use it in GitHub Desktop.
a good file
# Example
from urllib2 import urlopen
import random
cat = (random.randint(100,500), random.randint(100,500))
site = urlopen('http://placekitten.com/{}/{}'.format(*cat))
data = site.read()
cat_file = open('demoncat.jpg','w')
cat_file.write(data)
cat_file.close()
with open('cat.jpg','wb') as f:
f.write(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment