不知道哪里出错了,请大家指出,到最后没有输出全部,只能得到 a
result1 = [1,"2", "a"]
for item in result1:
print(item)
with open(r'E:\tools\fenci1.txt', 'a+') as file:
file.write("\r\n")
file.write(str(item) + "\r\n")
file.write("".join(str(item)) + os.linesep)
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
大概是因为你的缩进错了?你是不是写成这样了:
但是你想要的是这样?
另外,不懂的话,打开文件时不要用
+
这个标志。