Skip to content

Commit d2e8651

Browse files
committed
added script
0 parents  commit d2e8651

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

raffle.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import csv
2+
import random
3+
import sys
4+
from random import shuffle
5+
winlist = []
6+
with open(sys.argv[1]) as csvfile:
7+
reader = csv.DictReader(csvfile)
8+
for row in reader:
9+
username = row['What username do you go by online?']
10+
if row['What username do you go by online?'] == '-':
11+
username = row['Ticket First Name']
12+
winlist.append(row['Number'] + " " + username)
13+
[print(thing) for thing in random.sample(winlist, len(winlist))[0:30]]
14+
slide = open('slide.html','w')
15+
slide.write("""
16+
<!DOCTYPE html>
17+
<html>
18+
<head>
19+
<meta charset="UTF-8">
20+
<title>SMK Winter Meetup 2018 Winners!</title>
21+
<h1>And the winners are...</h1>
22+
</head>
23+
<body>
24+
""")
25+
for i in random.sample(winlist, len(winlist))[0:30]:
26+
slide.write("<p>"+i+"</p>\n")
27+
slide.write("""
28+
</body>
29+
</html>
30+
""")
31+
slide.close()

0 commit comments

Comments
 (0)