Jun-25-2020, 09:34 AM
(This post was last modified: Jun-25-2020, 10:39 AM by glennford49.)
how to make a list out of this ?
is this the right approach?
looping a dictionary and making a list of each every keys
is this the right approach?
users={"glenn":1,"elena":2,"mama":3} names=(list(users.keys())) for i in names: # i should become a list of each 3 keys in a dictionay print(type(i)) # output = <class 'list'>my goal is something like this:
looping a dictionary and making a list of each every keys
users={"glenn":1,"elena":2,"mama":3} names=(list(users.keys())) for i in names: # for each ? i dont know what is the correct approach of this # i should become a list of each 3 keys in a dictionay i=list(i) print(type(i)) print(type(glenn)) # confirming if its a list but, i think its impossible coz its outside of the for loopI only want to loop the dictionary to get each keys as list item