string.title()

Python 字符串 Python 字符串

描述

Python title() 方法返回"标题化"的字符串,就是说所有单词都是以大写开始,其余字母均为小写(见 istitle())。

语法

title()方法语法:

str.title();
w≡╝3≡╝x≡╝u≡╝e.com提供本在线速查手册,请勿盗用!

参数

返回值

返回"标题化"的字符串,就是说所有单词都是以大写开始。

实例

以下实例展示了 title()函数的使用方法:

#!/usr/bin/python

str = "this is string example....wow!!!";
print str.title();
w≡╝3≡╝x≡╝u≡╝e.com提供本在线速查手册,请勿盗用!

以上实例输出结果如下:

This Is String Example....Wow!!!
w≡╝3≡╝x≡╝u≡╝e.com提供本在线速查手册,请勿盗用!

Python 字符串 Python 字符串