python - Regex - how to capture many words -
i have simple regex question:
given string "test-class" regex should use ['test','class'] (in python context)
you don't need regex; use str.split():
>>> 'test-class'.split('-') ['test', 'class'] a regex solution still split:
>>> import re >>> re.split(r'-', 'test-class') ['test', 'class']
Comments
Post a Comment