Last Key in Python Dictionary

后端 未结 10 1024
栀梦
栀梦 2021-01-31 13:58

I am having difficulty figuring out what the syntax would be for the last key in a Python dictionary. I know that for a Python list, one may say this to denote the last:

10条回答
  •  南旧
    南旧 (楼主)
    2021-01-31 14:07

    In python 3.6 I got the value of last key from the following code

    list(dict.keys())[-1]
    

提交回复
热议问题