no message
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# 不能通过索引访问元素
|
||||
# 自动去重
|
||||
# 元素必须是可哈希的(如 int, str, tuple),不能包含 list、dict、set 等可变类型
|
||||
set1 = {
|
||||
'中国','小日本','漂亮国','中国'
|
||||
}
|
||||
set2 = set(['中国','小日本','漂亮国'])
|
||||
print(set1)
|
||||
print(set2)
|
||||
@@ -0,0 +1,15 @@
|
||||
# 元祖使用() 字典使用{} 列表使用[]
|
||||
# 元祖不能修改、删除 有序,可重复,不可扩展
|
||||
# 元祖可以作为字段的key
|
||||
a = ('键盘','鼠标')
|
||||
contacts = {
|
||||
'name':'张三',
|
||||
'sex':"男",
|
||||
'salary':'8000'
|
||||
}
|
||||
contacts[a] = 'xxx' # 元祖作为字典的key
|
||||
print(contacts)
|
||||
print(contacts[a])
|
||||
print('-----')
|
||||
print(a[0])
|
||||
print(a[1])
|
||||
Reference in New Issue
Block a user