Concatenating Tuple

前端 未结 7 1219
-上瘾入骨i
-上瘾入骨i 2020-12-29 20:40

Suppose I have a list:

a=[1,2,3,4,5]  

Now I want to convert this list into a tuple. I thought coding something like this would do:

相关标签:
7条回答
  • 2020-12-29 21:45

    tuple is not mutable in python.

    so after you initial it with tuple(...), it can't be modified.

    a = [1,2,3,4,5]
    tuple(a) 
    
    0 讨论(0)
提交回复
热议问题