Python add item to the tuple

后端 未结 7 2088
暗喜
暗喜 2020-12-22 16:11

I have some object.ID-s which I try to store in the user session as tuple. When I add first one it works but tuple looks like (u\'2\',) but when I try to add ne

7条回答
  •  再見小時候
    2020-12-22 17:00

    #1 form

    a = ('x', 'y')
    b = a + ('z',)
    print(b)
    

    #2 form

    a = ('x', 'y')
    b = a + tuple('b')
    print(b)
    

提交回复
热议问题