How to find multiple occurrence of a pattern in a string and store all occurrences in a list as multiple elements. for example:
re.search('[A-Z]+',"assAAhhhAB").group(0)
would give me :
AA
whereas I want output as
['AA' ,'AB']
Use re.findall:
import re
print(re.findall('[A-Z]+',"assAAhhhAB"))
# => ['AA', 'AB']
See the Python demo