Python里面如何实现tuple和list的转换?

#list to tuple
lis=[1,2,3,4,5,6]
x=tuple(lis)
print(type(x),x)

#tuple to list
tup=(1,2,3,4,5,6)
y=list(tup)
print(type(y),y)

输出

(<type 'tuple'>, (1, 2, 3, 4, 5, 6))
(<type 'list'>, [1, 2, 3, 4, 5, 6])
原文地址:https://www.cnblogs.com/sea-stream/p/11191703.html