有关以下代码:
print(type(row[0]))
print(type(df_inputfile[3].tolist()))
if(row[0] is None):
print("NONE!")
else:
print("NOT NONE")
if(df_inputfile[3] is None):
print("NONE!")
else:
print("NOT NONE")
found_labels = fnmatch.filter(df_inputfile[3].tolist(), row[0])
#print(type(found_labels))
我得到输出:
class 'str'
class 'list'
NOT NONE
NOT NONE
TypeError: 'NoneType' object is not iterable
我不明白为什么会发生这个错误,因为fnmatch.filter的输入是非空的、正确的参数
全部输出为:
debug: 2020-06-09 13:03:13.353673:: FOA_EstimatesAndActuals_Parser.py: Starting application
Processing Source Files\2020 Q1 Post Earnings\ABBV June 2020 Post Earnings D1.xlsx...
Processing Source Files\2020 Q1 Post Earnings\ABBV June 2020 Post Earnings D1.xlsx...
<class 'str'>
<class 'list'>
NOT NONE
NOT NONE
error: 2020-06-09 13:03:18.119950:: FOA_EstimatesAndActuals_Parser.py: Fatal error
Traceback (most recent call last):
File "C:\Users\moefinger\source\repos\data-engineering\Python\FOA Parser\FOA Parser\FOA_EstimatesAndActuals_Parser.py", line 185, in <module>
df1, df2 = process_file(regex_file_path, filename, label_file) # write df_results (both actuals and estimates) and df_results_est (only estimates)
TypeError: 'NoneType' object is not iterable
Press any key to continue . . .
请检查列表中是否有非类型元素
我试图为您重现这个问题:
结果:
相关问题 更多 >
编程相关推荐