regex - Match string and put all results in a list in Python -
i going match string, , want put matched strings list; how that?
right using this
mystr = 'one 2 1 three' match = re.match(r'one', mystr) but when print content of variable match using print m.group(), displays first occurrence. want occurrences , put values list.
>>> import re >>> re.findall(r'one', 'one 2 1 three') ['one', 'one']
Comments
Post a Comment