Python Forum
Create a dictionary from a list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create a dictionary from a list
#2
Try
Dict_data = {k: v[0] for k, v in data.items()}
Reply


Messages In This Thread
Create a dictionary from a list - by klllmmm - Oct-06-2019, 04:26 PM
RE: Create a dictionary from a list - by Gribouillis - Oct-06-2019, 04:29 PM
RE: Create a dictionary from a list - by klllmmm - Oct-06-2019, 05:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sort a list of dictionaries by the only dictionary key Calab 2 747 Apr-29-2024, 04:38 PM
Last Post: Calab
  Dictionary in a list bashage 2 672 Dec-27-2023, 04:04 PM
Last Post: deanhystad
  filtering a list of dictionary as per given criteria jss 5 839 Dec-23-2023, 08:47 AM
Last Post: Gribouillis
  Delete strings from a list to create a new only number list Dvdscot 8 1,760 May-01-2023, 09:06 PM
Last Post: deanhystad
  How to add list to dictionary? Kull_Khan 3 1,115 Apr-04-2023, 08:35 AM
Last Post: ClaytonMorrison
  [split] why can't i create a list of numbers (ints) with random.randrange() astral_travel 7 1,677 Oct-23-2022, 11:13 PM
Last Post: Pedroski55
  check if element is in a list in a dictionary value ambrozote 4 2,133 May-11-2022, 06:05 PM
Last Post: deanhystad
  Create new dictionary angus1964 6 2,258 May-08-2022, 12:43 PM
Last Post: snippsat
  Create new dictionary angus1964 2 1,354 May-06-2022, 02:14 PM
Last Post: deanhystad
  Dictionary from a list failed, help needed leoahum 7 2,149 Apr-28-2022, 06:59 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