Python - Change case with built-in string functions
Case conversion in Python is quite easy with those built-in string functions:
swapcase()
Return a copy of the string with uppercase characters converted to lowercase and vice versa.
upper()
Return a copy of the string converted to uppercase.
title()
Return a titlecased version of the string: words start with uppercase characters, all remaining cased characters are lowercase.
lower()
Return a copy of the string converted to lowercase.
capitalize()
Return a copy of the string with only its first character capitalized.
References: http://docs.python.org/2/library/stdtypes.html#string-methods
swapcase()
Return a copy of the string with uppercase characters converted to lowercase and vice versa.
upper()
Return a copy of the string converted to uppercase.
title()
Return a titlecased version of the string: words start with uppercase characters, all remaining cased characters are lowercase.
lower()
Return a copy of the string converted to lowercase.
capitalize()
Return a copy of the string with only its first character capitalized.
References: http://docs.python.org/2/library/stdtypes.html#string-methods
Comments
Post a Comment