Skip to content

Instantly share code, notes, and snippets.

@BrettMayson
Last active August 29, 2015 14:10
Show Gist options
  • Save BrettMayson/6234ad45306623b13a1e to your computer and use it in GitHub Desktop.
Save BrettMayson/6234ad45306623b13a1e to your computer and use it in GitHub Desktop.
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