import re rx = re.compile(r'\s*(\S+)\s*') string = """(CNN)Meaalofa Te'o -- Buemi. Canberra,"""words = rx.findall(string)print(words)
Standard input is empty
['(CNN)Meaalofa', "Te'o", '--', 'Buemi.', 'Canberra,']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!