python 元组tuple 增删改查操作
初始化:
data_tuple = ()
data_tuple1 = (1,)
data_tuple2 = tuple()
新增:
data_tuple+data_tuple1
(data_tuple,1,'a')
data_tuple[:2]+(object,)+data_tuple[:2] 向第3个元素位置处加上一个对象object
删除:
data_tuple[:2]+data_tuple[3:] 删除第3个元素
查询:
data_tuple[index]
data_tuple.index(object_value)
data_tuple.count(object_value)
value in data_tuple
value not in data_tuple
for item in data_tuple:
生命很短,请让生活更精彩一些!