prev next | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
I have an even longer list of animals on the internet, at http://davidbau.com/data/animals.
If your computer happens to be connected to the internet, you can load this data in python using a function called "urllib.urlopen". (URLs are what web addresses are called, so urllib stands for "URL library," and urlopen means "open a URL.")
The code looks like this:
import urllib animals = urllib.urlopen('http://davidbau.com/data/animals').read().split() secret = random.choice(animals)
What this means is:
import urllib
animals = urllib.urlopen('http://davidbau.com/data/animals').read().split()
animals = urllib.urlopen('http://davidbau.com/data/animals').read().split()
animals = urllib.urlopen('http://davidbau.com/data/animals').read().split()
animals = urllib.urlopen('http://davidbau.com/data/animals').read().split()
secret = random.choice(animals)
You can use urllib to load up more data than you could ever type
in yourself.