Python string case conversion method

Python String Case Conversion Methods

These are one of Python’s built-in methods for converting alphabetic characters in string objects. The following methods belong to this category:

Number Method and Description
1 capitalize() Converts the first letter of a string to uppercase.
2

3 lower() Converts all uppercase letters in a string to lowercase.
4 swapcase() Reverses the case of all letters in a string.
5 title() Returns the “title format” of a string, i.e., all words have their first letter capitalized and the rest lowercase.
6 upper() Converts lowercase letters in a string to uppercase.

Let’s discuss these methods with examples.

Leave a Reply

Your email address will not be published. Required fields are marked *