I am trying to split my string into a list, separating by whitespace and characters but leaving numbers together.
For example, the string:
"1 2 +="
would end up as:
["1", " ", "2", " " ,"+", "="]
The code I currently have is
temp = re.findall('\d+|\S', input)
This seperates the string as intended but does also remove the whitespace, how do I stop this?
\s
? – rogaos Nov 18 '13 at 22:00