In this source code example, we will demonstrate how to use the Python string title() method to convert a string to titlecase.
Use the Python string title() method to return the title-cased version of a string.
Python
Python String
The titlecase is a capitalization style used for titles so that the first letter of each word is uppercase and the remaining letters are lowercase.
Python string title() method
The following shows the syntax of the title() method:
str.title()
Python string title() method example
s = 'source code examples'
name = s.title()
print(name)
Output:
Source Code Examples
Related Python String Examples
- Python string literals
- Python string length example
- Python String join() method example
- Python string split() method example
- Python String index() method example
- Python string find() method example
- Python string startswith() method example
- Python string endswith() method example
- Python String lower() method example
- Python String upper() method example
- Python string title() method example
- Python string capitalize() method example
- Python string islower() method example
- Python string istitle() method example
- Python string isupper() method example
- Python string swapcase() method example
- Python string strip() method example
- Python string replace() method example
- Python string isdigit() method example
- Python string isdecimal() method example
- Python string isnumeric() method example
- Python string isalpha() method example
- Python string isalnum() method example
Comments
Post a Comment