1# import required package
2import re
3
4# Function checks if the input string(test)
5# contains any special character or not
6def check_splcharacter(test):
7
8 # Make an RE character set and pass
9 # this as an argument in compile function
10
11 string_check= re.compile('[@_!#$%^&*()<>?/\|}{~:]')
12
13 # Pass the string in search function
14 # of RE object (string_check).
15
16 if(string_check.search(test) == None):
17 print("String does not contain Special Characters.")
18
19 else:
20 print("String contains Special Characters.")