Python3 字符串 Python3 字符串


描述

Python title() 方法返回"標(biāo)題化"的字符串,就是說(shuō)所有單詞都是以大寫(xiě)開(kāi)始,其余字母均為小寫(xiě)(見(jiàn) istitle())。

語(yǔ)法

title()方法語(yǔ)法:

str.title();

參數(shù)

  • NA。

返回值

返回"標(biāo)題化"的字符串,就是說(shuō)所有單詞都是以大寫(xiě)開(kāi)始。

實(shí)例

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

#!/usr/bin/python

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

以上實(shí)例輸出結(jié)果如下:

This Is String Example From W3CSchool....Wow!!!

Python3 字符串 Python3 字符串