FAQ on Python title() method
Q: What does the title() method do in Python?
The title() method is a built-in Python string method that returns a new string with the first character of each word capitalized, and all other characters in lowercase. It is used to convert a string into title case format.
Q: How does the title() method work?
The title() method scans the string and identifies word boundaries based on whitespace characters. It then converts the first character of each word to uppercase and the remaining characters to lowercase. It returns a new string with the modified formatting.
Q: What is the syntax for using the title() method?
The title() method is called on a string object using dot notation. The syntax is as follows: string.title()
Q: Does the title() method modify the original string?
No, the title() method does not modify the original string. Instead, it returns a new string with the modified formatting. If you want to store the modified string, you need to assign the result to a variable.
Python String Title method
Python String title() method returns a new string after converting the first letter of every word to uppercase(capital) and keeping the rest of the letters lowercase.
Example: Make string title case
Python3
print ( "usE stRing title Method" .title()) |
Output
Use String Title Method