标签:
#!/usr/bin/python3 #元组 tup1 = (‘Google‘, ‘Runoob‘, 1997, 2000) print(type(tup1)) print("tup1 ",tup1) #创建空元组 tup2 = () #创建一个元素 一定要用 , tup3 = (4,) print(type(tup3)) #修改元组 元组里面的元素是不允许修改的 #修改是非法的,无效的 #tup1[0] = "update" print("tup1[0]",tup1[0]) tup1 = tup1 + tup3 print("tup1 ",tup1) #删除元组 #del tup1 print("len(tup1) ",len(tup1)) #max min #tuple(list) 将列表转元组
标签:
原文地址:http://www.cnblogs.com/qin1991/p/5910182.html