Python max() メソッド

Python 文字列


説明

Python max() メソッドは文字列の中で最も大きい文字を返します。

構文

max() メソッドの構文:

max(str)

パラメータ

  • str -- 文字列。

戻り値

文字列の中で最も大きい文字を返します。

例

以下の例では max() 関数の使用方法を示しています:

#!/usr/bin/python

str = "this is really a string example....wow!!!";
print "Max character: " + max(str);

str = "this is a string example....wow!!!";
print "Max character: " + max(str);

上記の例の出力結果は次のとおりです:

Max character: y
Max character: x

Python 文字列

その他の拡張