import rep = re.compile(r'\w+|[^\w\s]+')s = "There is light!"print(p.findall(s))
Standard input is empty
['There', 'is', 'light', '!']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!