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,480 points
1,097 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,770 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
839 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,840 points
670 views
0 votes
1 answer

How do I get the number of elements in a list

items = [] items.append("apple") items.append("orange") items.append("banana") len(items) #use the ...READ MORE

answered Feb 15, 2022 in Python by Dev
• 6,000 points
709 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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,466 views
0 votes
1 answer
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 27, 2020 in Python by Gitika
• 65,770 points
555 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,770 points
1,456 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP