Hello,
I have this:
>>> import re
>>> s = "Association of British Travel Agents (ABTA) No. 56542\nAir
Travel Organisation Licence (ATOL)\nAppointed Agents of IATA
(IATA)\nIncentive Travel & Meet. Association (ITMA)"
>>> licenses = re.split("\n+", s)
>>> licenseRe = re.compile(r'\(([A-Z]+)\)( No. (\d+))?')
>>> for license in licenses:
... m = licenseRe.search(license)
... print m.group(1, 3)
...
('ABTA', '56542')
('ATOL', None)
('IATA', None)
('ITMA', None)
What is the best way to also extract the affiliation name i.e:
'Association of British Travel Agents',
'Air Travel Organisation Licence'
etc..
Thanks
Norman
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor