first elements of a list of tuples python code example
Example: how to extract the first elements from a list of tuples
tuple_list = [("a", "b"),("c", "d")]
first_tuple_elements = []
for a_tuple in tuple_list:
first_tuple_elements.append(a_tuple[0])
print(first_tuple_elements)
#OUTPUT: ['a', 'c']