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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -