首页 > 编程语言 > 详细

[python]Tuple

时间:2016-06-05 12:33:50      阅读:183      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!