Python max()方法
描述
Python max() 方法返回字符串中最大的字母。
语法
max()方法语法:
max(str)
参数
- str -- 字符串。
返回值
返回字符串中最大的字母。
示例
以下实例展示了 max()函数的使用方法:
示例(Python 2.0+)
#!/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