# coding=utf8

dict_info = {"abc": 1, 1: "liuzhipeng"}
for k, v in dict_info.items():
    print "{key}->{value}".format(key=k, value=v)

print dict_info.keys()
print dict_info.values()
print dict_info.items()

dict_info.update(abc=3,name="liu",)
print dict_info


#输出
C:\Python27\python.exe C:/Users/Administrator/PycharmProjects/oldboy/lesson_3/test.py
1->liuzhipeng
abc->1
[1, 'abc']
['liuzhipeng', 1]
[(1, 'liuzhipeng'), ('abc', 1)]
{1: 'liuzhipeng', 'abc': 3, 'name': 'liu'}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
  • 2021-04-19
  • 2022-12-23
  • 2021-09-27
  • 2021-08-25
猜你喜欢
  • 2021-08-15
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案