Skip to content

Instantly share code, notes, and snippets.

@xlevus
Created March 17, 2010 23:14
Show Gist options
  • Save xlevus/335844 to your computer and use it in GitHub Desktop.
Save xlevus/335844 to your computer and use it in GitHub Desktop.
import random
import urllib2
from BeautifulSoup import BeautifulSoup
req = urllib2.urlopen('http://c2.com/cgi/wiki?AntiPatternsCatalog')
soup = BeautifulSoup(req.read())
lists = list(soup.findAll("li"))
random.shuffle(lists)
def new_card():
print "<table border=1>"
for i in range(0,5):
print "<tr>"
for j in range(0,5):
item = lists.pop()
href = item.a['href']
item.a['href'] = "http://c2.com/cgi/%s" % href
print "<td>%s<br/><input type='checkbox' /></td>" % item.a
print "</tr>"
print
print "</table>"
for i in range(0,5):
new_card()
print "<br />"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment