##### How to make a list of values from a dictionary list?
 How to make a list of values from a dictionary list? faryad13 Programmer named Tim Posts: 15 Threads: 6 Joined: Sep 2020 Reputation: Sep-03-2020, 01:27 PM Hello Guys Good day I have a list with dictionaries inside: L=[{'X': 2593.75}, {'X': 2457.42}, {'X': 2593.75}, {'X': 2457.42}] How can I make a new list only with the values. I mean something like: L_new=[2593.75,2457.42,2593.75,2457.42] Thank you! Reply DeaD_EyE Da Bishop Posts: 1,666 Threads: 6 Joined: May 2017 Reputation: Sep-03-2020, 02:15 PM (This post was last modified: Sep-03-2020, 02:15 PM by DeaD_EyE.) Iterate over the elements, access the key "X" and append it to a new list. ```results = [] for element in L: ... # this is your task```https://docs.python.org/3/tutorial/datas...e-on-lists https://docs.python.org/3/tutorial/datas...ctionaries PS: L is a bad name. My code examples are always for Python >=3.6.0 Almost dead, but too lazy to die: https://sourceserver.info All humans together. We don't need politicians! Reply faryad13 Programmer named Tim Posts: 15 Threads: 6 Joined: Sep 2020 Reputation: Sep-03-2020, 03:45 PM (Sep-03-2020, 02:15 PM)DeaD_EyE Wrote: Iterate over the elements, access the key "X" and append it to a new list. ```results = [] for element in L: ... # this is your task```https://docs.python.org/3/tutorial/datas...e-on-lists https://docs.python.org/3/tutorial/datas...ctionaries PS: L is a bad name. Thank you very much for your kind answer! Reply

 Possibly Related Threads… Thread Author Replies Views Last Post Why changing data in a copied list changes the original list? plumberpy 3 360 Aug-14-2021, 02:26 AM Last Post: plumberpy Make Groups with the List Elements quest 2 382 Jul-11-2021, 09:58 AM Last Post: perfringo Compile list of dictianories out of another list of dictianories by certain keys CatorCanulis 10 906 Jun-10-2021, 08:35 PM Last Post: perfringo Getting values from a dictionary brunolelli 5 949 Mar-31-2021, 11:57 PM Last Post: snippsat Python dictionary with values as list to CSV Sritej26 4 781 Mar-27-2021, 05:53 PM Last Post: Sritej26 Order a list with successive permutations based on another list yvrob 3 747 Mar-19-2021, 08:20 AM Last Post: supuflounder Conceptualizing modulus. How to compare & communicate with values in a Dictionary Kaanyrvhok 7 1,100 Mar-15-2021, 05:43 PM Last Post: Kaanyrvhok Saving list in a list quest_ 3 893 Mar-10-2021, 09:58 AM Last Post: quest_ Convert Bytearray into List using list() Shlok 2 651 Feb-18-2021, 10:44 AM Last Post: deanhystad How to make a 3D List of Excel Spreadsheets? chatguy 4 744 Jan-24-2021, 05:24 AM Last Post: buran

Forum Jump:

### User Panel Messages

##### Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020