-
Notifications
You must be signed in to change notification settings - Fork 1
/
parser.py
43 lines (33 loc) · 1 KB
/
parser.py
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
def dataParser(data):
result = []
name = "Name(first last):"
email = "Email:"
sex = "Sex(M/F):"
teamID = "Team Name:"
projectName = "Project Name:"
projectStat = "Project status(C for complete,I for incomplete):"
f_name = data.rfind(name)
f_email = data.rfind(email)
f_sex = data.rfind(sex)
f_teamID = data.rfind(teamID)
f_proName = data.rfind(projectName)
f_proStat = data.rfind(projectStat)
nLoc = f_name + len(name)
emLoc = f_email + len(email)
sLoc = f_sex + len(sex)
tLoc = f_teamID + len(teamID)
pnLoc = f_proName + len(projectName)
psLoc = f_proStat + len(projectStat)
nm = data[nLoc:f_email]
result.append(nm.strip())
em = data[emLoc:f_sex]
result.append(em.strip())
se = data[sLoc:f_teamID]
result.append(se.strip())
td = data[tLoc:f_proName]
result.append(td.strip())
pn = data[pnLoc:f_proStat]
result.append(pn.strip())
ps = data[psLoc:]
result.append(ps.strip())
return result