Dict KeyError for value in the dict

前端 未结 4 1800
Happy的楠姐
Happy的楠姐 2021-01-20 02:02

I have a dict inside a dict:

{
\'123456789\': {u\'PhoneOwner\': u\'Bob\', \'Frequency\': 0},
\'98765431\': {u\'PhoneOwner\': u\'Sarah\', \'Frequency\': 0},
         


        
4条回答
  •  感情败类
    2021-01-20 02:07

    Use integers as keys:

    {
    123456789: {u'PhoneOwner': u'Bob', 'Frequency': 0},
    98765431: {u'PhoneOwner': u'Sarah', 'Frequency': 0},
    }
    

    You have strings as keys but you need integers.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题