check if special character in string python

string = "Daneshwar$/?$Daneshwar"
regex = re.compile('[@_!#$%^&*()<>?/\|}{~:]')
if( == None):
	print("special is absent")

Here is what the above code is Doing:
1. We first import the re module.
2. We then use re.compile() so we can use regex.
3. Pass the string you want to check into re.compile().
4. We use to search for the pattern in string.
5. If the pattern is found, returns a match object.
6. If the pattern is not found, returns None.
7. We use if…else to check if the pattern is found or not.