iNTERFACEWARE Products Manual > Learning Center > Learning Python > Working With Strings > String Functions > String Capitalization |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
Python provides several useful functions that specify which letters of a string are to be in upper case (capitalized), and which are to be in lower case (non-capitalized). The following table lists these capitalization functions:
The capitalize() function capitalizes the first character of the string, if possible, and converts the remaining characters to lower case. Characters that are not letters of the alphabet remain unchanged.
The lower() function converts all alphabetic characters to lower case:
The swapcase() function converts upper case characters to lower case, and lower case to upper case:
The title() function converts the first character of every word to upper case, and converts the other alphabetic characters to lower case:
The upper() function converts all alphabetic characters to upper case:
|