Skip to content

Instantly share code, notes, and snippets.

from sys import argv
prompt = '>'
months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']
print "Type the number of a month"
number = raw_input(prompt)
number=int(number)
month = months[number + 1]
print "%s" % month
print "You enter a dark room with three doors. Do you go through door 1, 2, or 3?"
door = raw_input("> ")
if door == "1":
print "There's a giant bear here eating a cheese cake. What do you do?"
print "1. Take the cake."
print "2. Scream at the bear."
bear = raw_input("> ")
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("https://www.cia.gov/library/publications/the-world-factbook/geos/da.html")
bsObj = BeautifulSoup(html, "html5lib")
t = open("denmark.txt", 'w')
items = bsObj.findAll("ul", {"class":"expandcollapse"})
for item in items:
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
html = urlopen("http://www.imdb.com/chart/top")
bsObj = BeautifulSoup(html, "html.parser")
t = open("imdb250.txt", 'w')
for link in bsObj.find("div", {"id":"pagecontent"}).findAll( "a", href=re.compile("^(/title/)(.)*$") ):
if 'href' in link.attrs: