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

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -