Python出错:TypeError: coercing to Unicode: need string or buffer, NoneType found

其中train_accuracy_top5_nbatch_filename是文件的名字,赋值时代码形如

train_accuracy_top5_nbatch_filename = "a" + "b" + "c" + ".log"

但是在执行

train_accuracy_top5_nbatch_file_op = open(train_accuracy_top5_nbatch_filename, "a")

时出错。

解决方法:

train_accuracy_top5_nbatch_file_op = open(str(train_accuracy_top5_nbatch_filename), "a")

 

你可能感兴趣的:(Python,error)