Python-string-max

提供:Dev Guides
移動先:案内検索

Python String max()メソッド

説明

Python文字列メソッド* max()*は、文字列_str_から最大アルファベット文字を返します。

構文

以下は* max()*メソッドの構文です-

max(str)

パラメーター

  • 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