-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnameGetter.py
More file actions
23 lines (22 loc) · 752 Bytes
/
nameGetter.py
File metadata and controls
23 lines (22 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import time
with open('finder2.html', 'r') as f:
for line in f:
if 'staff:' in line.lower() or 'student:' in line.lower():
if 'staff' in line.lower():
role = 'Staff'
else: role = 'Student'
# print line
splits = line.split(':')[1].split(',')
if len(splits) > 2:
forename = splits[1].lstrip( )
surname = splits[0].lstrip( )
idnumber = splits[2].lstrip( ).split('<')[0]
else:
forename = splits[0].split(' ')[0]
surname = splits[0].split(' ')[1]
idnumber = splits[1].split('<')[0]
for splitEnum in splits:
if len(splitEnum) < 3:
print 'Sleeping for', splitEnum
time.sleep(3)
print 'Role:\t\t{0}\nForename:\t{1}\nSurname:\t{2}\nIDNumber:\t{3}\n'.format(role, forename, surname, idnumber)