【问题标题】:TypeError: 'list' object is not callable" after for loop is executed类型错误:'list' 对象不可调用”for 循环执行后
【发布时间】:2022-06-17 23:58:10
【问题描述】:

我看到一个回溯 "report_single([single_timestamp, single_test_passed, single_test_failed, single_error_code,single_error_description]) TypeError: 'list' 对象不可调用"

 for i in range(number_of_json_files):
      report.append([fetch[i], test_passed_output_array_final[i], test_failed_output_array_final[i], fetch_error_code [i], error_description_array_final[i]])
      df1 = pd.DataFrame(report, columns=cols)
      # print("Water of of citrus fruits", i)
      df1.to_excel('pandas_to_excel.xlsx', sheet_name='new_sheet_name')
 print("I am the last element in main", fetch[i])
 print(type(fetch_error_code[i]))

 single_timestamp = fetch[i]
 single_test_passed = test_passed_output_array_final[i]
 single_test_failed = test_failed_output_array_final[i]
 single_error_code = fetch_error_code[i]
 single_error_description = error_description_array_final[i]
 print(single_timestamp, single_test_passed, single_test_failed,single_error_code, single_error_description)
 if (single_error_code == "PT-100" or "PT-200" or "PT-400" or "PT-500"):
      print(single_error_code)
      report_single([single_timestamp, single_test_passed, single_test_failed, single_error_code,single_error_description])
      df1 = pd.DataFrame(report_single, columns=cols)
      df1.to_excel('do_not_append.xlsx', sheet_name='new_sheet_name')

【问题讨论】:

  • 显然,report_single 是一个列表,看起来您正在尝试调用它,而列表无法做到这一点。

标签: python


猜你喜欢
  • 1970-01-01
  • 2021-05-26
  • 2016-10-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-21
  • 2014-06-13
  • 1970-01-01
相关资源
最近更新 更多