python中列表,元组的乘法

直接上code吧,还可以这么玩儿

li=[1,]
li=li*3
print(li)

out:
[1, 1, 1]

===========
>>> t=(1,2)
>>> t*3
(1, 2, 1, 2, 1, 2)

但字典,集合不能这么玩

posted @ 2016-06-01 17:41  ccorz  阅读(2478)  评论(0编辑  收藏  举报