Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
l1 = [u'Forgot your password?\nForgot your computing ID?\nComputing ID Management\nmyLibrary', u'Name: #FILLER#\nCommon Name: #FILLER#\nRoles: Undergrad\nDept:\nPhone:\nExternal Email:\nSFU ID: #FILLER#\nLibrary Barcode: #FILLER#\nAccount is sponsored: No\nAccount is lightweight: No\nAccount expiry:', u"#FILLER#\nTo protect your privacy, quit the browser when you're finished.\nLogout"]

l2 = [u'Current Mailing Address\nHome/Permanent Address\#FILLER#\#FILLER#\nNone\nMain Phone Number\nSFU Email Address\nNone\#FILLER#']

for s in l1:
  if s.lower().startswith('name'):
    name = s.split()[1]  # the name is between a space and a newline, so split() will hit both and neatly partition the data we want
    print(f'name: {name}')

for s in l2:
  if s.lower().startswith('current mailing address'):
    addr = s.split('\n')[1].lstrip('Home/Permanent Address\\') # if there's a space or other delimiting character, we can be more clever here...
    print(f'address: {addr}')