python: 字典的keys() values() 取得字典的键与值

>>> attr={"class":"avdata card","data-hash-id":"data-hash-id"}
>>> attr.keys()
dict_keys(['class', 'data-hash-id'])
>>> list(attr.keys())
['class', 'data-hash-id']
>>> attr.values()
dict_values(['avdata card', 'data-hash-id'])
>>> list(attr.values())
['avdata card', 'data-hash-id']
>>> 

 

posted @ 2023-03-09 16:43  myrj  阅读(38)  评论(0编辑  收藏  举报