小括号:()
小括号代表 tuple 元组数据类型
举例:
# 一般元组
tup0 = (1, 2, 3)
print("tup0 = ", tup0)
# 空元组
tup1 = ()
print("tup1 = ", tup1)
# 一个值的元组
tup2 = (55,)
print("tup2 = ", tup2)
# 不是元组
tup3 = (55)
print("tup3 = ", tup3)
tup0 = (1, 2, 3)
tup1 = ()
tup2 = (55,)
tup3 = 55
中括号:[]
中括号代表 list 列表数据类型
举例:
# 形成多个元素的列表
list1 = list('python')
print("list1 = ", list1)# 只有一个元素的列表
list2 = list(["python"])
print("list2 = ", list2)
list1 = ['p', 'y', 't', 'h', 'o', 'n']
list2 = ['python']
大括号:{}
大括号代表dict字典数据类型
举例:
dict1 = {'tatiana': "mygirl", 'bluff': 'mydog'}
print("dict1 = ", dict1)
dict1 = {'tatiana': 'mygirl', 'bluff': 'mydog'}