How to print a dictionary's key?

前端 未结 20 830
眼角桃花
眼角桃花 2020-11-27 09:22

I would like to print a specific Python dictionary key:

mydic = {}
mydic[\'key_name\'] = \'value_name\'

Now I can check if mydic.has_

20条回答
  •  爱一瞬间的悲伤
    2020-11-27 09:59

    The name of the key 'key_name' is key_name, therefore print 'key_name' or whatever variable you have representing it.

提交回复
热议问题