Python中把字典和值取出来

2020-12-13 03:31

阅读:371

标签:字典   highlight   tuple   div   pytho   python   values   pre   name   

a = {"name":‘qiliyan‘,‘sex‘:‘man‘}
print(tuple(a.keys()))
#(‘name‘, ‘sex‘)
print(tuple(a.values()))
#(‘qiliyan‘, ‘man‘)
for key in a.keys():
    print(key)
#name
#sex
for value in a.values():
    print(value)
# qiliyan
# man

  

Python中把字典和值取出来

标签:字典   highlight   tuple   div   pytho   python   values   pre   name   

原文地址:https://www.cnblogs.com/qiaoer1993/p/11077646.html


评论


亲,登录后才可以留言!