Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Dictionaries
#1
Please how do i store a list in the value pair of a dictionary?
For example, myDict = {key:[1,2,3,4,5,6,7,8]}

I want to get input from users where their unique id number is the key and other details will be stored in the list.
Reply
#2
Just like you put an example..
user_details = {
 1:[some details],
 2:[dome details]
}
if _id in user_details:
    user_details[_id].append(details)
Reply


Forum Jump:

User Panel Messages

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