I write my code that way, I want to assign matched values to 'm' but lst[1] may not including the pat I want. if it does, so I'll keep do something about 'm' eg: m.group(2).split() ....
if re.match(pat, lst[1]):
m=re.match(pat, lst[1])
But I don't want to repeat the re.match(pat, lst[1]) twice.
I want to achieve in that way
if m = re.match(pat, lst[i])
but it shows me "invalid syntax error. any ideas?
m = re.match(pat, lst[i])thenmwill beNoneif there are no matches; you can completely get rid of theif.