Created
May 29, 2015 20:20
-
-
Save krisrice/5980512fa83f72779b69 to your computer and use it in GitHub Desktop.
devops-against-humanity
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
#!/usr/bin/env python | |
import urllib.request, csv, random, re | |
u='https://raw.githubusercontent.com/bridgetkromhout/devops-against-humanity/master/cards-DevOpsAgainstHumanity.csv' | |
white=[] | |
black=[] | |
lines = urllib.request.urlopen(u).read().decode('utf-8').split('\n') | |
for line in lines: | |
r=line.split(",") | |
if len(r) == 2: | |
if r[0]: white.append(r[0]) | |
if r[1]: black.append(r[1]) | |
blank=re.compile(r"( +)?(\b|[^_])_+(\b|[^_])( +)?") | |
rpl=lambda _:" %s " % random.choice(white) | |
for _ in range(10): | |
print(re.sub(blank,rpl,random.choice(black)).strip().replace(' .','.')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment