Latest web development tutorials

Python title()方法

Python 字符串 Python字符串


描述

Python title() 方法返回"標題化"的字符串,就是說所有單詞都是以大寫開​​始,其餘字母均為小寫(見istitle())。

語法

title()方法語法:

str.title();

參數

  • NA。

返回值

返回"標題化"的字符串,就是說所有單詞都是以大寫開​​始。

實例

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

#!/usr/bin/python

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

以上實例輸出結果如下:

This Is String Example....Wow!!!

Python 字符串 Python字符串