Message336936
Say for example i want to apply a regex on a list of strings.
Using list comprehension as such results in the group method not being found.
```
name_regex = compile(r'\[\"([a-zA-Z\s]*)\"{1}')
named_entities = [name_regex.match(entity.trigger).group(1) for entity in entities[0]]
```
This unexpected behavior can also be observed when implementing this using a map.
```
list(map(lambda x: name_regex.search(x.trigger).group(), entities[0]))
```
However using the traditional for loop implementation the group method is resolved.
```
named_entities = []
for entity in entities[0]:
named_entities.append(name_regex.match(entity.trigger).group(1))
``` |
|
Date |
User |
Action |
Args |
2019-03-01 17:21:57 | Matthew Drago | set | recipients:
+ Matthew Drago, ezio.melotti, mrabarnett |
2019-03-01 17:21:57 | Matthew Drago | set | messageid: <1551460917.2.0.142475833674.issue36158@roundup.psfhosted.org> |
2019-03-01 17:21:57 | Matthew Drago | link | issue36158 messages |
2019-03-01 17:21:57 | Matthew Drago | create | |
|