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

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

解决方法:

检查字典属性拼写

增加字典属性判断:

if ‘body’ in d.keys()


猜你喜欢

转载自www.cnblogs.com/yowamushi/p/9581248.html