Last active
August 29, 2015 14:10
-
-
Save BrettMayson/6234ad45306623b13a1e 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 | |
peopleD = {} | |
peopleL = [] | |
peopleM = [] | |
pfile = open("santa.txt") | |
data = pfile.read() | |
pfile.close() | |
for l in data.split("\n")[:-1]: | |
name,email = l.split(" ") | |
peopleD[name] = email | |
peopleL.append(name) | |
peopleM.append(name) | |
def shuffle(a,b): | |
random.shuffle(a) | |
f = False | |
for x in range(0,len(a)): | |
if a[x] == b[x]: | |
f = True | |
if f: | |
return shuffle(a,b) | |
else: | |
return a | |
peopleM = shuffle(peopleM,peopleL) | |
for x in range(0,len(peopleL)): | |
urllib2.urlopen("http://bmandesigns.com/sendSanta.php?email="+peopleL[peopleD[x]]+"&person="+peopleM[x]+"&name="+peopleL[x]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment