This code below matches all non-word characters from the given string and prints their list.
Example
import re
s = 'ab5z8d*$&Y@'
regx = re.compile('\W')
result = regx.findall(s)
print resultOutput
This gives the output
['*', '$', '&', '@']
This code below matches all non-word characters from the given string and prints their list.
import re
s = 'ab5z8d*$&Y@'
regx = re.compile('\W')
result = regx.findall(s)
print resultThis gives the output
['*', '$', '&', '@']