Answers for "python detect special characters in string"

4

check if special character in string python

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

python - count values that contain special characters

special = '[(_:/,#%\=@)]'                    # Define special characters
df['count'] = df['myvar'].str.count(special) # Count them
Posted by: Guest on July-02-2020

Code answers related to "python detect special characters in string"

Python Answers by Framework

Browse Popular Code Answers by Language