forked from PesuOrg/ThirdSemFilter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrintDetails.py
More file actions
32 lines (24 loc) · 703 Bytes
/
PrintDetails.py
File metadata and controls
32 lines (24 loc) · 703 Bytes
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
import csv
import json
def parseCsv():
people = {}
with open('input.csv', 'r') as csvFile:
reader = csv.DictReader(csvFile)
for row in reader:
if(row['SRN'] not in people):
people[str(row['SRN']).lower()] = { 'Name': '', 'Email': row['Username']}
return people
def parseJson():
with open('people.json', 'r') as jsonFile:
return json.load(jsonFile)
people = parseJson()
while True:
print("Enter SRN, enter exit to end the program")
srn = input()
if(srn == 'exit'):
break
srn = str(srn).lower()
if(srn in people):
print(people[srn])
else:
print("Please enter a valid usn")