刚刚更新的python版本,对一个列表使用upper(),显示错误“listobject is not attribute'upper'这是为什么啊?
list没办法用lower upper应该是单个元素用
result = list([x.upper() for x in list])
你的错误很明显,因为你操作的是list这种数据结构,的确没有upper的属性,你要对list里面的值进行单独转换操作,才可以达到你的要求。