import re
# add a number of non-word chars
a = "!@#@!#@!#@!#@python11111java6789python\t\n\r"
# get all the numbers, can use \d or [0-9]
r = re.findall("\s", a)
# \w is equivalent to [a-zA-Z0-9_]
r
['\t', '\n', '\r']