how to add value to a tuple?

后端 未结 8 1697
别那么骄傲
别那么骄傲 2020-12-08 03:43

I\'m working on a script where I have a list of tuples like (\'1\',\'2\',\'3\',\'4\'). e.g.:

list = [(\'1\',\'2\',\'3\',\'4\'),
        (\'2\',\         


        
8条回答
  •  醉梦人生
    2020-12-08 04:25

    OUTPUTS = []
    for number in range(len(list_of_tuples))):
        tup_ = list_of_tuples[number]
        list_ = list(tup_)  
        item_ = list_[0] + list_[1] + list_[2] + list_[3]
        list_.append(item_)
        OUTPUTS.append(tuple(list_))
    

    OUTPUTS is what you desire

提交回复
热议问题