I am using the following code:
CARRIS_REGEX=r\'(\\d+) ([\\s\\w\\.\\-]+) (\\d+:\\d+) (\\d+m)
-
You can't make them behave the same way, because they're different. If you really want to create a list of results from finditer
, then you could use a list comprehension:
>>> [match for match in pattern.finditer(mailbody)]
[...]
In general, use a for
loop to access the matches returned by re.finditer
:
>>> for match in pattern.finditer(mailbody):
... ...
- 热议问题