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 result
Output
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 result
This gives the output
['*', '$', '&', '@']