How would I print the name of the keys instead of their stored values?


#1
for key in webster:
  print webster[key]

Gives me the key values correct?

How would I print the name of the keys instead of their stored values?


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

webster is defined, correct?


#3

I saw the answer to my question in another post. So I tried to delete my posts, but it didn’t?

Edit: Oh, you reinstated it.
I’m not sure what you mean by defined. If I remember the lesson, webster was a dictionary with several keys and values.


#4

I reinstated it so the question would be answered.


#5

Print(webster.keys()) will return all the keys without using For loop.

But if you wanna print the key one by one using For,
for key in webster:
print(key)


#6

Thanks, that’s very helpful.


#7