How do I Print a List's Keys?


how to print only “key” instead of “key: value” when programming on a list?

FAQ: Learn Python: A Day at the Supermarket - This is KEY!

Hi! To find out what I can do, say @discobot display help.


discobot is a bot, it only has few limited options. Its not capable of answering programming questions

Your question is confusing, a list only has values, no keys. key value pairs are for dictionaries


my mistake. i was referring to “dictionaries”
how to only print "key"s but not pairs of key-value.

for example: dictionary = { “A”: 1 , “B”:2, “C”:3)
how to print only " A B C "?


we have the keys method:

or we could just loop over the dictionary, that would give us keys as well.