for遍历用例数据时,报错:TypeError: list indices must be integers, not dict,'int' object is not iterable解决方法

一:报错:TypeError: list indices must be integers, not dict

  for i in range(0,len(test_data)):

   suite.addTest(TestCaselogin("test_api",test_data[i][*arg]))

  解决方法:是参数表示不正确的原因:test_data[i][*arg] 应该表示为item[*arg]

二:报错:'int' object is not iterable

   
 for i in len(A):
      print("lll")
   解决方法:len(A) 改为range(len(A))
 
原文地址:https://www.cnblogs.com/guotang/p/12366835.html