Python String Function:
We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it. |
lower() | Returns the string with all uppercase letters converted to lowercase. |
upper() | Returns the string with all lowercase letters converted to uppercase. |
title() | Returns the string with the first letter of every word in the string in uppercase and the rest in lowercase. |
capitalize() | Returns the string with the first letter of the word in the string in uppercase and the rest in lowercase. |
find() | This method is used to locate the position of the given substring within the string; find returns -1 if it is unsuccessful in finding the substring. |
index() | Same as find() but raises an exception if the substring is not present in the given string. |
isalpha() | Returns True if the string contains only letters, otherwise returns False. |
isdigit() | Returns True if the string contains only digits and False otherwise. |
isalnum() | Returns True if the string contains only letters and digits, i.e., all characters are alphanumeric and Flase otherwise if the string contains any special character like _, @, #, * including space. |
Comments (No)