Skip to content

Instantly share code, notes, and snippets.

@nicholsonjf
Last active April 29, 2020 20:33
Show Gist options
  • Save nicholsonjf/14deeaf7b81d879fddc7b91597a1a4f7 to your computer and use it in GitHub Desktop.
Save nicholsonjf/14deeaf7b81d879fddc7b91597a1a4f7 to your computer and use it in GitHub Desktop.
Mailman Faculty Parsing
import re, csv
reg = re.compile('(?<=Name: )(?P<faculty_name>.+)(?= HUID).+(?<=NETID: )(?P<faculty_3x3>.+)(?= EPPN)')
with open('grouper-export/groupExportAll_SPHFaculty.csv') as fdata:
freader = csv.reader(fdata)
with open('faculty-filenames.csv', 'w') as ffile:
fieldnames = ['faculty_name', 'faculty_3x3', 'filename']
writer = csv.DictWriter(ffile, fieldnames=fieldnames)
writer.writeheader()
for row in freader:
result = reg.finditer(row[1])
for obj in result:
rowDict = obj.groupdict()
rowDict['filename'] = rowDict['faculty_3x3'] + '.jpg'
writer.writerow(rowDict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment