统计一段文本中出现最多的字母

用max自带函数

def find_max():
    # 统计一段文本中出现最多的字母
    # 函数会把第一个参数的每个值依次放入key提供的比较大小的方法里
    import string
    text = "dengyexun"
    return max(string.ascii_lowercase, key=text.count)
时刻记着自己要成为什么样的人!
原文地址:https://www.cnblogs.com/demo-deng/p/15420507.html