python元组与字典:

2020-12-13 04:12

阅读:602

标签:列表   python元组   value   更改   key   象棋   元素   查找   定义   

#定义元组(),元组与列表类似但元素不可以更改
a=(1,2,3,4,5,6,"a","b","c","d","e","f")
print(a)

#定义字典{key:value},用key快速查找value
b={"name":"小明","age":18,"hobby":"象棋"}
#key不可重复,value可以重复
print(b)
print(b["age"])

python元组与字典:

标签:列表   python元组   value   更改   key   象棋   元素   查找   定义   

原文地址:https://www.cnblogs.com/lma0702/p/11106198.html


评论


亲,登录后才可以留言!