Latest web development tutorials

Pythonのタイトル()メソッド

Python文字列 Python文字列


説明

Pythonのタイトル()メソッドは、首都で始まるすべての単語である文字列の "タイトル"を返し、残りの文字が小文字です(istitle()参照)。

文法

タイトル()メソッドの構文:

str.title();

パラメータ

  • NA。

戻り値

首都で始まるすべての単語である文字列のバック "タイトル"。

次の例では、使用するタイトル()関数を示しています。

#!/usr/bin/python

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

次のように上記の出力結果の例は次のとおりです。

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

Python文字列 Python文字列