无涯教程-Python - max(str)函数

81 阅读1分钟

Python字符串方法max()返回字符串字符串的最大字母字符。

max(str) - 语法

max(str)
  • str  -  这是需要返回的最大字母字符的字符串。

max(str) - 返回值

此方法返回字符串中的最大字母字符。

max(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

参考链接

www.learnfk.com/python/stri…