requests+unittest接口自动化之报错:TypeError: list indices must be integers or slices, not str

今天再做接口自动化练习的时候,碰到了这个报错,

初看一下,就是数据类型错误。

报错:TypeError: list indices must be integers or slices, not str

仔细分析一下自己的报错信息,发现,原来是list的索引错误了。

解决方法:

少了那个索引,导致把后面的字符串当成了索引,所以会报以上的错误。

原文地址:https://www.cnblogs.com/star12111/p/14901414.html