M
M
mikhal_ivanych2020-05-24 13:38:50
Python
mikhal_ivanych, 2020-05-24 13:38:50

How to make a list of tuples from a list of dictionaries?

Hello.
What is the error in creating a list of tuples from a list of dictionaries?

lst = [{"a": 1}, {"b": 2}, {"c": 3}]

tuples = [tuple(x) for x in lst]
print(tuples)


Result:
[('a', ), ('b', ), ('c' ,)]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question