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
#1
I have some data in a dictionary but its values are in a list. I want to create a dictionary from these values.

data = {'data':[{'Info':100,'GPSInfo': {1: 'N',2:'S'}}]}
How can I create a dictionary similar to this,

Dict_data = {'data':{'Info':100,'GPSInfo': {1: 'N',2:'S'}}}
Appreciate if someone can help with this
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 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 672 Apr-29-2024, 04:38 PM
Last Post: Calab
  Dictionary in a list bashage 2 614 Dec-27-2023, 04:04 PM
Last Post: deanhystad
  filtering a list of dictionary as per given criteria jss 5 768 Dec-23-2023, 08:47 AM
Last Post: Gribouillis
  Delete strings from a list to create a new only number list Dvdscot 8 1,612 May-01-2023, 09:06 PM
Last Post: deanhystad
  How to add list to dictionary? Kull_Khan 3 1,063 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,606 Oct-23-2022, 11:13 PM
Last Post: Pedroski55
  check if element is in a list in a dictionary value ambrozote 4 2,059 May-11-2022, 06:05 PM
Last Post: deanhystad
  Create new dictionary angus1964 6 2,162 May-08-2022, 12:43 PM
Last Post: snippsat
  Create new dictionary angus1964 2 1,312 May-06-2022, 02:14 PM
Last Post: deanhystad
  Dictionary from a list failed, help needed leoahum 7 2,069 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