Python3-string-max
提供:Dev Guides
Python 3-String max()メソッド
説明
- max()*メソッドは、文字列strから最大のアルファベット文字を返します。
構文
以下は* max()*メソッドの構文です-
パラメーター
戻り値
このメソッドは、文字列strから最大アルファベット文字を返します。
例
次の例は、max()メソッドの使用法を示しています。
結果
上記のプログラムを実行すると、次の結果が生成されます-
以下は* max()*メソッドの構文です-
max(str)
*str* -これは、最大のアルファベット文字を返す必要がある文字列です。
このメソッドは、文字列strから最大アルファベット文字を返します。
次の例は、max()メソッドの使用法を示しています。
#!/usr/bin/python3
str = "this is a string example....really!!!"
print ("Max character: " + max(str))
str = "this is a string example....wow!!!"
print ("Max character: " + max(str))
上記のプログラムを実行すると、次の結果が生成されます-
Max character: y
Max character: x