Python Forum
Help with Dictionaries and List of Lists
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Dictionaries and List of Lists
#3
You create a new_list each time and then set the dictionary key to that single list, so any previous lists are lost. Do instead
        for attribute in attributes:
                    .....
            my_list.append(value)
 
        print(my_list) #this prints out exactly what I need to go into my PA_dict list of lists
        ## adds new list, and keeps previous lists
        PA_dict[permissionName].append(my_list) 
Reply


Messages In This Thread
RE: Help with Dictionaries and List of Lists - by woooee - Feb-14-2019, 04:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sort a list of dictionaries by the only dictionary key Calab 2 610 Apr-29-2024, 04:38 PM
Last Post: Calab
  Access list of dictionaries britesc 4 1,105 Jul-26-2023, 05:00 AM
Last Post: Pedroski55
  List all possibilities of a nested-list by flattened lists sparkt 1 945 Feb-23-2023, 02:21 PM
Last Post: sparkt
  user input values into list of lists tauros73 3 1,096 Dec-29-2022, 05:54 PM
Last Post: deanhystad
  returning a List of Lists nafshar 3 1,111 Oct-28-2022, 06:28 PM
Last Post: deanhystad
  Creating list of lists, with objects from lists sgrinderud 7 1,715 Oct-01-2022, 07:15 PM
Last Post: Skaperen
  How to efficiently average same entries of lists in a list xquad 5 2,177 Dec-17-2021, 04:44 PM
Last Post: xquad
  sorting a list of lists by an element leapcfm 3 1,920 Sep-10-2021, 03:33 PM
Last Post: leapcfm
  behavior list of lists roym 5 2,146 Jul-04-2021, 04:43 PM
Last Post: roym
  List of lists - merge sublists with common elements medatib531 1 3,424 May-09-2021, 07:49 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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