Created
March 17, 2010 23:14
-
-
Save xlevus/335844 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "</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