tuple特殊
tuple在只有一个成员的时候,定义的时候后面必须加一个",",否则判断不出来是否是tuple
比如:
var = (5×6)
vartuple = (5×6,)
list和tuple相互转换
spam = (1,2,3,4)
spamlist = list(spam)
spamlist.append(5)
print (spamlist)
spamtuple = tuple(spamlist)
tuple特殊
tuple在只有一个成员的时候,定义的时候后面必须加一个",",否则判断不出来是否是tuple
比如:
var = (5×6)
vartuple = (5×6,)
list和tuple相互转换
spam = (1,2,3,4)
spamlist = list(spam)
spamlist.append(5)
print (spamlist)
spamtuple = tuple(spamlist)