python check if string contains special characters code example
Example 1: python - count values that contain special characters
special = '[(_:/,#%\=@)]' # Define special characters
df['count'] = df['myvar'].str.count(special) # Count them
Example 2: python check if string contains one of characters list
if any(ext in url_string for ext in extensionsToCheck):
print(url_string)