list() and tuple() : Convert to Tuple « Tuple « Python Tutorial






aList = ['tao', 93, 99, 'time']
aTuple = tuple(aList)
print aList, aTuple
aList == aTuple
anotherList = list(aTuple)
aList == anotherList
print aList is anotherList
print [id(x) for x in aList, aTuple, anotherList]








6.5.Convert to Tuple
6.5.1.The tuple function takes one sequence argument and converts it to a tuple
6.5.2.List to tuple
6.5.3.list() and tuple()