I'm trying to figure out a way to loop through a list in one line to use in a regular expression.
The following works almost like I want to, when going through a large text file:
for line in x1:
For item in Feature_Type:
if re.findall("(?i)^"+ item, line):
active_feature_type = re.findall("(?i)^"+ item, line)
I have a list with a number of words:
Feature_Type = ["New feature", "Resolved feature", "Electrical feature",...]
The problem is that I'd somehow actually need to fuse the first "For" and "If"-statement into just an "If"-statement to continue with a number of else statements after this, some of them similar to this one, if possible.
Aucun commentaire:
Enregistrer un commentaire