Python check if any character of string is special character

Code examples

6
0

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

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................