Answer by Thales for Python list of tuples: increase number of tuple members
You can convert the tuple to a list, change it, and then converting back to a tuplea[0] = list(a[0])a[0].append("red")a[0] = tuple(a[0])Just loop this for the entire list and it should work
View ArticleAnswer by Dvip for Python list of tuples: increase number of tuple members
tuples are immutable so you cannot append().If you want to add stuffs you should use python lists.Hope, that might help you!
View ArticleAnswer by Matthias for Python list of tuples: increase number of tuple members
Since a tuple is immutable you have to create new tuples. I assume you want to add this additional value to every tuple in the list.a = [('1', 'hello', 'en'), ('2', 'hi', 'en')]color = 'red'a = [(x +...
View ArticlePython list of tuples: increase number of tuple members
I have a list of tuples with the pattern "id", "text", "language" like this:a = [('1', 'hello', 'en'), ...]I would like to increase number of tuple members to "id", "text", "language", "color":b =...
View Article
More Pages to Explore .....