[python]TypeError: string indices must be integers解决方法

读取字典不存在的属性时报错。

解决方法:

检查字典属性拼写

增加字典属性判断:

if ‘body’ in d.keys()


posted @ 2018-09-03 21:48  弱虫  阅读(19942)  评论(0编辑  收藏  举报