Latest web development tutorials

Python max()方法

Python 字符串 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 字符串 Python字符串