Mar-08-2020, 09:30 PM
(This post was last modified: Mar-08-2020, 09:30 PM by deanhystad.)
re.match returns a MatchObject or None. Your code is taking the "string" attribute of the MatchObject and adding that to the list. The string attribute is the string passed to match. Take a look at MatchObject and see how it can provide the string you really want.
This may do what you want:
This may do what you want:
secondList = [i.group(0) for i in firstList if regex.match(i)]