python tuple 元组
元组:不可变,无序 tuple
1,定义:a,一维元组/b,二维元组/c,三维元组
2,访问:a,正/b,反
3,切片:a,正切/b,反切/c,混合切
4,遍历:a,一维遍历/b,二维遍历
1,定义
a,一维元组
userinfo1=(1,"zhangsan",18,"sales")
print(userinfo1)
(1, ‘zhangsan’, 18, ‘sales’)
b,二维元组
userinfo1=((1,"zhangsan",18,"sales"),(2,"wangwu",20,"it"))
print(userinfo1)
((1, ‘zhangsan’, 18, ‘sales’), (2, ‘wangwu’, 20, ‘it’))
c,三维元组
userinfo1=((1,"zhangsan",18,"sales"),(2,"wangwu",20,"it",(3,"zhaoliu",16,