Python3 capitalize()メソッド
説明
Python capitalize() は、文字列の最初の文字を大文字にし、他の文字を小文字にします。
構文
capitalize() メソッドの構文:
str.capitalize()
パラメータ
- なし。
戻り値
このメソッドは、最初の文字が大文字の文字列を返します。
例
以下の例は、capitalize() メソッドの例を示しています。
例
#!/usr/bin/python3
str = "this is string Example From サンプル....wow!!!"
print ("str.capitalize() : ", str.capitalize())
str = "this is string Example From サンプル....wow!!!"
print ("str.capitalize() : ", str.capitalize())
上記の例の出力結果は次のとおりです:
str.capitalize() : This is string example from サンプル....wow!!!
その他の拡張
Python3 文字列