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

0 votes
Can anyone explain the above mentioned query?
Jun 23, 2020 in Python by Roshni
• 10,420 points
127 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, 2020 by Gitika
• 65,870 points

Related Questions In Python

0 votes
1 answer

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

my_dict = {'one': 'first', 'two': 'second', 'three': ...READ MORE

answered Sep 30, 2020 in Python by VJ_python
94 views
0 votes
1 answer

How do I get the number of elements in a list?

Hello, The len() function can be used with several different ...READ MORE

answered Nov 18, 2020 in Python by Niroj
• 82,580 points
47 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
388 views
0 votes
2 answers
+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,855 views
0 votes
0 answers
0 votes
1 answer

How do I get a substring of a string in Python?

>>> x = "Hello World!" >>> x[2:] 'llo World!' >>> ...READ MORE

answered Nov 26, 2020 in Python by Gitika
• 65,870 points
51 views
0 votes
1 answer

How to find the index of an item in a list?

One thing that is really helpful in ...READ MORE

answered Dec 3, 2020 in Python by Gitika
• 65,870 points
133 views