Most Useful String Functions in Python

Most Useful String Functions in Python 1. len(str) : Returns Length of String str=input("Enter String : ") print("LENGTH OF ",str," : ",len(str)) -------------------------------------------- 2. str.upper() : Converts all characters in the string to uppercase. str=input("Enter String in Lower Case Letter : ") print(str.upper()) -------------------------------------------- 3. str.lower() : Converts all characters in the string to lowercase. str=input("Enter String in UPPER Case Letter : ") print(str.lower()) -------------------------------------------- 4. str.capitalize() : Capitalizes the first letter of the string and converts all other characters to lowercase. str=input("Enter String in lower Case Letter : ") print(str.capitalize()) -------------------------------------------- 5. str.title() : Capitalizes the first letter of each word in the string. str=input("Enter String in lowe...