@
目录
# @FILE : demo3_tuple.py
# @SoftWare : PyCharm
'''
tup1 = () # 创建空的元组
print(type(tup1)) #空的元组,它的数据类型还是元组
tup1 = (50,) #单个元素在元组里,要加逗号分隔
print(type(tup1)) #否则,比如存放Int类型数据后,就不是元组了
'''
'''
tup2 = (111,222,333,444,"aaa","bbb")
print(tup2[-1]) #访问元组里最后一个元素
print(tup2[0:2]) #左闭右开
'''
#增
'''
tup1 = (1,2,3)
tup2 = ("a","b","c")
print(tup1+tup2) #两个元组直接相加,进行拼接
'''
#删
tup1 = (1,2,3)
del tup1 #将删除tup1这个变量
print(tup1) #删除后,不能输出,报错:没有定义此变量