String Methods

Strings have methods that allow you to perform operations on them.

str.lower()

Returns a copy of the string with all alphabetic letters converted to lowercase. Any character that is already lowercase, or is not an alphabetic letter, is unchanged.

str.upper()

Returns a copy of the string with all alphabetic letters converted to uppercase. Any character that is already uppercase, or is not an alphabetic letter, is unchanged.

str.strip()

Returns a copy of the string with all leading and trailing whitespace characters removed.

str.title()

Returns a titlecased version of the string with the remaining characters in lowercase.

Reference: https://docs.python.org/3/library/stdtypes.html#string-methods

Last updated