-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattendance.py
More file actions
54 lines (37 loc) · 1.29 KB
/
attendance.py
File metadata and controls
54 lines (37 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import time
import datetime
#names = ["Jackathon", "Boomer Kingston", "Paul Deangelo-Willis"]
menu_options = ["1) Sign in", "2) Sign out", "3) Quit"]
def main():
# THIS IS ALL NEW--------------------
ids = {}
with open("ids.csv", "r") as ins:
for line in ins:
(key, val) = line.split(',')
ids[key] = int(val)
print(ids)
# -------------------------------------
global name
name = input("What's your name?")
if name in ids:
choice = input("Select your command:\n" + " ".join(menu_options) + "\n")
choice = int(choice)
#stuff that was in the log() function
print("Logging file...")
log_file = open("log.csv","a")
time.sleep(0.1)
#this next thing is new
if choice == 1:
log_file.write("\n" + name + ", " + str(datetime.datetime.now()) + ",SIGNED IN")
print("You are now signed in!")
elif choice == 2:
log_file.write("\n" + name + ", " + str(datetime.datetime.now()) + " SIGNED OUT")
print("You are now signed out! Thanks for coming!")
else:
time.sleep(0.1)
else:
print("Sorry. Please enter a valid name")
main()
#print("Main has been called!")
if __name__ == "__main__":
main()