Python字符串 |最大限度()
max()是Python编程语言中的一个内置函数,它返回字符串中字母字符的字符串。
句法:
max(string)
范围:
max() 方法接受一个字符串作为参数
返回值:
Returns a character which is alphabetically the highest character in the string.
下面是方法max()的Python实现
Python
# python program to demonstrate the use of
# max() function
# maximum alphabetical character in
# "geeks"
string = "geeks"
print max(string)
# maximum alphabetical character in
# "raj"
string = "raj"
print max(string)
输出:
s
r