Harald Kirsch <kirschh at lionbioscience.com> writes: > I would like to have the mapping from the index to the name, i.e. if > m.group(i) matches, I would like to know if there is a name > corresponding to i. In the above example this would give me "X" for > i==1. I can't find anything obvious in the re module. You'd have to invert the .groupindex dictionary attribute of the compiled pattern. Following your example: >>> r.groupindex {'X': 1} --amk
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4