samb <[email protected]> writes: > or like : > > m = re.match(r'define\s+(\S+)\s*{$', line) > if m: > thing = m.group(1) > else: > m = re.match(r'include\s+(\S+)$', line) > if m: > thing = m.group(1) > else > thing = "" > > Which isn't nice neither because I'm going to have maybe 20 match > tests and I wouldn't like to have 20 indentations.
for pat in [r'define\s+(\S+)\s*{$', r'include\s+(\S+)$', ...]:
m = re.match(pat, line)
...
--
http://mail.python.org/mailman/listinfo/python-list
