hi. s = 'Association of British Travel Agents (ABTA) No.56542\nAir Travel Organisation Licence (ATOL)\nAppointed Agents ofIATA (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', None) ('ATOL', None) ('IATA', None) ('ITMA', None) The no 56542 is not getting into m.group()
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor