码迷,mamicode.com
首页 > 编程语言 > 详细

[python]Tuple

时间:2016-06-05 12:37:05      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

A tuple is similar to list but can not be modified

tuple1 = (1,)

tuple2 = (1,2,3,4)

to refer elemetn in a tuple

var1 = tuple[0]

var2 = tuple[-1]

just like what we do to list.

so here is the question, in what condition do we have to use tuple instead of list?

[python]Tuple

标签:

原文地址:http://www.cnblogs.com/lmliu/p/5560383.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!