gpt4 book ai didi

python - TypeError : '_io.TextIOWrapper' object is not callable, 创建文本文件错误

转载 作者:太空狗 更新时间:2023-10-30 01:07:06 24 4
gpt4 key购买 nike

    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' object is not callable' 错误,我绞尽脑汁,看了类似的问题,但还是一无所获

最佳答案

需要调用file_outputwrite方法,不能直接调用:

file_output.write('')

关于python - TypeError : '_io.TextIOWrapper' object is not callable, 创建文本文件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33421209/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com