Python 3.6解决报错:'NoneType' object has no attribute 'decode'的办法

for repo_dict in repo_dicts:
    names.append(repo_dict['name'])
    plot_dict={'value':repo_dict['stargazers_count'],
               'label':repo_dict['description'],
               'xlink':repo_dict['html_url'],
               }
    plot_dicts.append(plot_dict)

在运行上面代码时,出现了

'NoneType' object has no attribute 'decode'

的错误,查阅资料后发现只要将

'label':repo_dict['description']

改为:

'label': str(repo_dict['description'])

就可以解决问题了

作者:hhhaoyi815
来源:CSDN
原文:https://blog.csdn.net/weixin_42427638/article/details/80640817
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/weixin_44106928/article/details/88418154
今日推荐