How do you get a list of all the keys in a dictionary?

0 votes
Can anyone explain the above mentioned query?
Jun 23 in Python by Roshni
• 3,830 points
51 views

1 answer to this question.

0 votes

Hey, @Roshin,

I would like to give you an example so that you understand it better:

For this, we use the function keys():

 mydict={'a':1,'b':2,'c':3,'e':5}
 mydict.keys()
dict_keys([‘a’, ‘b’, ‘c’, ‘e’])

answered Jun 23 by Gitika
• 37,330 points

Related Questions In Python

0 votes
0 answers

how do i get the list of all the keys in my dictionary?

can you give an example? with the ...READ MORE

May 6, 2019 in Python by Waseem
• 4,540 points
51 views
+2 votes
2 answers

In a list of dictionaries, how can I find the minimum calue in a common dictionary field.

There are several options. Here is a ...READ MORE

answered Apr 10, 2018 in Python by charlie_brown
• 7,780 points
264 views
0 votes
1 answer

How do you get the logical xor of two variables in Python?

If you're already normalizing the inputs to ...READ MORE

answered May 29, 2018 in Python by aryya
• 7,380 points
8,574 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,352 views
0 votes
0 answers
+1 vote
7 answers

Count the frequency of an item in a python list

To count the number of appearances: from collections ...READ MORE

answered Oct 18, 2018 in Python by tinitales
10,644 views
0 votes
1 answer