Python3 字典
描述
Python 字典 items() 方法以列表返回可遍歷的(鍵, 值) 元組數(shù)組。
語法
items()方法語法:
dict.items()
參數(shù)
- NA。
返回值
返回可遍歷的(鍵, 值) 元組數(shù)組。
實例
以下實例展示了 items() 方法的使用方法:
#!/usr/bin/python3
dict = {'Name': 'W3CSchool', 'Age': 7}
print ("Value : %s" % dict.items())
以上實例輸出結(jié)果為:
Value : dict_items([('Name', 'W3CSchool'), ('Age', 7)])
更多建議: