min()是Python編程語言中的內置函數,可返回字符串中的最小字母字符。
用法:
min(string)
參數:
min()方法將字符串作為參數
返回值:
Returns a character which is alphabetically the lowest character in the string.
以下是min()方法的Python實現
# python program to demonstrate the use of
# min() function
# minimum alphabetical character in
# "geeks"
string = "geeks"
print(min(string))
# minimum alphabetical character in
# "raj"
string = "raj"
print(min(string))
輸出:
e a
相關用法
注:本文由純淨天空篩選整理自Striver大神的英文原創作品 Python String | min()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。