Python String title() Method
The Python title() method is used to return a string where the first character in every word is upper case, and the remaining characters are lower case. It returns a new string with the title cased version of the original string.
For example:
text = "hello world"
result = text.title()
print(result)
# Output: Hello World
You can also use title() on a string that contains numbers or symbols. The first letter after any number or symbol will be converted to upper case.
For example:
text = "234 k3l2 *43 fun"
result = text.title()
print(result)
# Output: 234 K3L2 *43 Fun
If you have any questions about this code, you can drop a line in comment.
Comments
Post a Comment