TypeError:“ _ io.TextIOWrapper”对象不可调用,创建文本文件错误 [英] TypeError: '_io.TextIOWrapper' object is not callable, creating text file error
本文介绍了TypeError:“ _ io.TextIOWrapper”对象不可调用,创建文本文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
list = [Blarg, T2, T3]
Rewrite(List)
def Rewrite(New2):
List_Length = len(New2)
L = 0
with open('Chronologiser2.BCF', 'w') as file_output:
file_output('')
while L < List_Length:
with open('Chronologiser2.BCF', 'a') as file_output:
Current_Text = New2[L]
file_output(str(Current_Text) + '/n')
L += 1
有人可以向我解释为什么我不断收到'TypeError:'_io .TextIOWrapper'对象不可调用'错误,我伤脑筋,看着类似的问题,但还是一无所获
Can someone explain to me why i keep getting the 'TypeError: '_io.TextIOWrapper' object is not callable' error, I've wracked my brain, looked at similair questions but still nothing
推荐答案
您需要调用 file_output
的 write
方法,而不是直接调用它:
you need to call the write
method of file_output
, not call it directly:
file_output.write('')
这篇关于TypeError:“ _ io.TextIOWrapper”对象不可调用,创建文本文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文