Answers for "python check special characters in string"

5

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
1

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 check special characters in string"

Python Answers by Framework

Browse Popular Code Answers by Language