I have a string :
line = "[kossor],(blommor),{skor},kossor,blommor,skor"
I want to write a pattern that matches the characters ()[] and {} and the words inside, like this:
['[kossor]', '(blommor)', '{skor}']
I used this method:
ligne = "[kossor],(blommor),{skor},kossor,blommor,skor"
pattern = "\(([^\)]+)\)"
ANSWER = re.findall(pattern, ligne)
I got this :
["blommor"]
Any ideas? thanks!
() [] {}? or can it have something like(blommor]? also, are all strings separated by,? for given sample ip/op, even a simplere.findall(r'[\[({][^,]+', line)would do