相关疑难解决方法(0)

Python 3中的Python 2 dict_items.sort()

我正在将一些代码从Python 2移植到3.这是Python 2语法中的有效代码:

def print_sorted_dictionary(dictionary):  
    items=dictionary.items()  
    items.sort()
Run Code Online (Sandbox Code Playgroud)

在Python 3中,dict_items没有方法'sort' - 我如何在Python 3中为此做出解决方法?

python python-3.x

1
推荐指数
1
解决办法
3925
查看次数

标签 统计

python ×1

python-3.x ×1