程序出现'NoneType' object is not iterable错误
下面是代码:num_list = input("please:").split(" ")
zi = {}
for i in num_list:
if i in zi:
zi = zi+1
else:
zi = 1
list_2 = list(zip(zi.values(),zi.keys()))# 将字典化为元组
print(list(zip(zi.values(),zi.keys())),end='')
list_3 = list_2.sort()# 将list_2按照值进行排序
print(list_3)
c = dict(list_3)
print(c)
# for j in list_3:
# print(j)
错误提示:
Traceback (most recent call last):
File "e:\code_test\python100\62.py", line 13, in <module>
c = dict(list_3)
TypeError: 'NoneType' object is not iterable
已经在网上搜了,没找到合适的解答,麻烦各位了 参考 docs.python.org/3/tutorial/datastructures.html?highlight=sort
list.sort 的返回值是? dolly_yos2 发表于 2022-9-19 21:37
参考 docs.python.org/3/tutorial/datastructures.html?highlight=sort
list.sort 的返回值是?
谢谢了
页:
[1]