Python 类型错误:'_io.TextIOWrapper';对象不可调用,创建文本文件错误 list=[Blarg,T2,T3] 重写(列表) def重写(新建2): 列表长度=len(新2) L=0 以open('chromeoiser2.BCF','w')作为文件\u输出: 文件输出(“”) 当L

Python 类型错误:'_io.TextIOWrapper';对象不可调用,创建文本文件错误 list=[Blarg,T2,T3] 重写(列表) def重写(新建2): 列表长度=len(新2) L=0 以open('chromeoiser2.BCF','w')作为文件\u输出: 文件输出(“”) 当L,python,error-handling,Python,Error Handling,有人能给我解释一下为什么我一直得到“TypeError:”\u io.TextIOWrapper“object is not callable”错误,我绞尽脑汁,看了类似的问题,但仍然没有什么问题,你需要调用文件输出的write方法,而不是直接调用它: list = [Blarg, T2, T3] Rewrite(List) def Rewrite(New2): List_Length = len(New2) L = 0

有人能给我解释一下为什么我一直得到“TypeError:”\u io.TextIOWrapper“object is not callable”错误,我绞尽脑汁,看了类似的问题,但仍然没有什么问题,你需要调用
文件输出的
write
方法,而不是直接调用它:

    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
file_output.write('')