how to append elements in tuple code example
Example 1: how to add number in tuple
a = ('2',)
b = 'z'
new = a + (b,)
Example 2: how to add strings in tuple in python
First, convert tuple to list by built-in function list().
You can always append item to list object.
Then use another built-in function tuple() to
convert this list object back to tuple.
You can see new element appended to original tuple representation.
by tutorialspoint.com
happy coding :D
Example 3: how to append a tuple to a list
a_list = []
a_list.append((1, 2))
a_list.append(tuple(3, 4))
Example 4: tuple push
a = ('Product', '500.00', '1200.00')
a = list(a)
a.insert(3, 'foobar')
a = tuple(a)
print a
>> ('Product', '500.00', '1200.00', 'foobar')