String comparison functions in Python

20-02-23 Ahmed Obaid 1234 0

Python provides a lot of built-in functions for manipulating strings. String in Python is immutable, so all these functions return a new string and the original string remains unchanged. You do not have to memorize all of these functions that we will mention in this article. All you have to know is how to use these functions and what they can do. All of these functions are present by default in the str class inside the builtins.py file, which is included in the Python interpreter. 






























































functio name the description Link
isspace() The isspace()  function checks if the characters in a string are whitespace. If the characters in the string are whitespace, it will return the boolean value True. Otherwise, it will return the boolean value False. The isspace ()  function treats space, newlines, tabs, etc. the same as white space read more  
isupper()  The isupper()  function checks if the characters in a string are uppercase. If the characters in the string are uppercase, it will return the boolean value True. Otherwise, it will return the boolean value False. read more  
islower()  The islower ()  function checks if the characters in a string are lowercase. If the characters in the string are lowercase, it will return the boolean value True. Otherwise, it will return the boolean value False. read more  
isdigit()  The isdigit()  function checks if all characters in a string are numeric characters. If all characters in the string are numeric characters it will return the boolean value True. Otherwise, it will return the boolean value False. read more  
isalnum()  The isalnum() function checks if all characters in a string are either alphanumeric or alphanumeric. If all characters in the string are alphanumeric characters, return the boolean value True. If otherwise, it returns the boolean value False. read more  
istitle()  istitle() returns True if the string is a title. otherwise it returns False.   read more  
isnumeric()  The isnumeric()  function checks if all characters in a string are numeric characters. If all characters in the string are numeric characters, return the boolean value True. If at least one character is not a numeric character, it returns the boolean value False. read more  
isalpha()  The isalpha() function checks if all characters in a string are alphanumeric. If all characters in the string are alphanumeric it returns the boolean value True. If at least one character is not alphanumeric, it returns the boolean value False. White spaces, numbers, and symbols are non-alphabetic characters.  read more  
startswith()  The startswith() function  checks if a string starts with a prefix . If so, startswith  ()  will return the boolean True , otherwise it will return the boolean false . read more  
endswith()  The endswith()  function checks if a string ends with a suffix . If so, the  endswith()  function will return the boolean True , otherwise it will return the boolean false .           read more  



Tags


Python python data types Python String string methods python python string istitle method String comparison functions in Python Python String endswith() Method Python String isalpha Method Python String isnumeric Method Python String isalnum Method Python String isdigit Method Python String islower Method python string isupper method python string isspace() method

Share page