Use of title() method in Python

不言
Release: 2018-04-10 15:15:53
Original
8106 people have browsed it

This article mainly introduces the use of the title() method in Python. Now I share it with you. Friends who need it can refer to it

The title() method returns the first character of all words in capital letters. A copy of the string.
Syntax

The following is the syntax of the title() method:

str.title();
Copy after login

Parameters

  • ## NA

Return value

This method returns the first few words of all words The characters are all uppercase and are a copy of the string.


Example

The following example shows the use of the title() method.

#!/usr/bin/python

str = "this is string example....wow!!!";
print str.title();
Copy after login

When we run the above program, it will produce the following results:

This Is String Example....Wow!!!
Copy after login

Related recommendations:

Detailed explanation of the sort method in python

The above is the detailed content of Use of title() method in Python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template