max()是Python編程語言中的內置函數,可返回字符串中最高的字母字符。
用法:
max(string)
參數:
max()方法將字符串作為參數
返回值:
Returns a character which is alphabetically the highest character in the string.
以下是max()方法的Python實現
# pythin 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
相關用法
注:本文由純淨天空篩選整理自Striver大神的英文原創作品 Python String | max()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。