How can I get list of values from dict?
You can use the values() method to get a list of values from a dictionary:
You can use the values() method to get a list of values from a dictionary:
Get list of values from dict in Python
python— editable, runs on the server
This will output:
[1, 2, 3]You can also use a list comprehension to get a list of values from a dictionary:
Get list of values from dict in Python using list comprehension
python— editable, runs on the server
This will also output:
[1, 2, 3]Both methods will provide you a list of values from the dict.