Strings and Character
Check Special Character
# āļāļĢāļ§āļāļŠāļāļāļ§āđāļēāļāđāļāļāļ§āļēāļĄāļāļąāļāļāļĨāđāļēāļ§āļĄāļĩāđāļĄāđāļĄāļĩāļāļąāļāļāļĢāļ°āļāļīāđāļĻāļĐāļŦāļĢāļ·āļāđāļĄāđ (āđāļĄāđāļĄāļĩ return = True)
# import required package
import re
# Function checks if the string
# contains any special character
def check_special_char(string):
# Make own character set and pass
# this as argument in compile method
regex = re.compile('[@_!#$%^&*()<>?/\|}{~:]')
# Pass the string in search
# method of regex object.
if(regex.search(string) == None):
return True
else:
return False
Last updated