python元组 (tuple,即常量数组)
tuple元组就是只可以使用list的 [],不能对其直接修改。通过:操作符提取元素。
list是中括号,tuple是圆括号
list = ['a', 'b', 'c', 'd', 'e']#列表 tuple = ('a', 'b', 'c', 'd', 'e') #元组
list 和 tuple 的相互转化
tuple(list) list(list)
本文共 250 字,大约阅读时间需要 1 分钟。
python元组 (tuple,即常量数组)
tuple元组就是只可以使用list的 [],不能对其直接修改。通过:操作符提取元素。
list是中括号,tuple是圆括号
list = ['a', 'b', 'c', 'd', 'e']#列表 tuple = ('a', 'b', 'c', 'd', 'e') #元组
list 和 tuple 的相互转化
tuple(list) list(list)
转载于:https://my.oschina.net/golang/blog/209272