Top "Tuples" questions

In programming, tuples are simple *product types*, representing ordered collections of types.

Python add item to the tuple

I have some object.ID-s which I try to store in the user session as tuple. When I add first …

python python-2.7 tuples
Find an element in a list of tuples

I have a list 'a' a= [(1,2),(1,4),(3,5),(5,7)] I need to find all the tuples for a particular number. say for 1 it …

python list search tuples
Getting one value from a tuple

Is there a way to get one value from a tuple in Python using expressions? def tup(): return (3, "hello") i = 5 + …

python tuples
Explicitly select items from a list or tuple

I have the following Python list (can also be a tuple): myList = ['foo', 'bar', 'baz', 'quux'] I can say >&…

python list select indexing tuples
Python convert tuple to string

I have a tuple of characters like such: ('a', 'b', 'c', 'd', 'g', 'x', 'r', 'e') How do I convert …

python string tuples
How to convert comma-delimited string to list in Python?

Given a string that is a sequence of several values separated by a commma: mStr = 'A,B,C,D,E' …

python parsing list tuples
How to easily initialize a list of Tuples?

I love tuples. They allow you to quickly group relevant information together without having to write a struct or class …

c# list collections .net-4.0 tuples
How to merge lists into a list of tuples?

What is the Pythonic approach to achieve the following? # Original lists: list_a = [1, 2, 3, 4] list_b = [5, 6, 7, 8] # List of tuples from 'list_…

python list merge tuples
Python: changing value in a tuple

I'm new to python so this question might be a little basic. I have a tuple called values which contains …

python tuples
Expanding tuples into arguments

Is there a way to expand a Python tuple into a function - as actual parameters? For example, here expand() …

python tuples parameter-passing