read student information using DictReader
This should be safer.
This commit is contained in:
parent
d2f0f4b850
commit
f46f00dc4d
20
coldcall.py
20
coldcall.py
@ -38,12 +38,8 @@ class ColdCall():
|
||||
|
||||
preferred_names = {}
|
||||
with open(self.__fn_studentinfo, 'r') as f:
|
||||
for line in f.readlines():
|
||||
x = line.strip().split("\t")
|
||||
if x[0] == "Timestamp":
|
||||
continue
|
||||
|
||||
preferred_names[x[4]] = x[2]
|
||||
for row in DictReader(f, delimiter="\t"):
|
||||
preferred_names[row["Your username on the class Discord server"]] = row["Name you'd like to go by in class"]
|
||||
|
||||
if selected_student in preferred_names:
|
||||
return preferred_names[selected_student]
|
||||
@ -104,11 +100,11 @@ class ColdCall():
|
||||
|
||||
# cc = ColdCall()
|
||||
|
||||
# test_student_list = ["Jordan", "Kristen Larrick", "Madison Heisterman", "Maria.Au20", "Laura (Alia) Levi", "Leona Aklipi", "Linya Feng", "anne", "kirst", "emmaaitelli", "ashleylee", "allie_partridge", "Tiana_Cole", "Hamin", "Ella Qu", "Angel Su", "Shizuka", "Ben Baird", "Kim Do", "Isaacm24", "Sam Bell", "Courtneylg", "TasnimHasan"]
|
||||
# cc.coldcall(test_student_list)
|
||||
# test_student_list = ["jordan", "Kristen Larrick", "Madison Heisterman", "Maria.Au20", "Laura (Alia) Levi", "Leona Aklipi", "Linya Feng", "anne", "kirst", "emmaaitelli", "ashleylee", "allie_partridge", "Tiana_Cole", "Hamin", "Ella Qu", "Angel Su", "Shizuka", "Ben Baird", "Kim Do", "Isaacm24", "Sam Bell", "Courtneylg", "TasnimHasan"]
|
||||
# print(cc.coldcall(test_student_list))
|
||||
|
||||
# test_student_list = ["Jordan", "Kristen Larrick", "Mako"]
|
||||
# cc.coldcall(test_student_list)
|
||||
# test_student_list = ["jordan", "Kristen Larrick", "Mako"]
|
||||
# print(cc.coldcall(test_student_list))
|
||||
|
||||
# test_student_list = ["Jordan", "Kristen Larrick"]
|
||||
# cc.coldcall(test_student_list)
|
||||
# test_student_list = ["jordan", "Kristen Larrick"]
|
||||
# print(cc.coldcall(test_student_list))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user