hausaufgabe--python 13-Tuple

000--functions for Tuple(the highlight ones) VS functions for List

 

001-- add one more tuple to original one with only 1 element, you need you use '' and ():

temp = ('one', 'two','four','five')

temp = temp[:2] + ('three',)+temp[2:]

 

002-- when you need to update the data (add,remove,change the value...), then use list; if you don't want any change for security issue, then use Tuple

 

003-- there is no Tuple comprehensions (it's enough with list comprehensions)

 

posted @ 2017-06-03 09:36  ReedyLi  阅读(207)  评论(0编辑  收藏  举报