>>> dict = {1:2,'a':'b','hello':'world'}
>>> dict.items()
[('a', 'b'), (1, 2), ('hello', 'world')]
>>> dict.keys()
['a', 1, 'hello']
>>> dict.values()
['b', 2, 'world']
>>> dict.items()[0]
('a', 'b')
Python中字典的items(), keys(), values()方法
猜你喜欢
转载自blog.csdn.net/gabby____/article/details/82624096
今日推荐
周排行