python 一次性在文件中写入多行

时间:2022-10-07 16:16:58

将要写入的内容 构造 进一个list 中,使用writelines()方法 一次性写入。

file_w.writelines(list)

file_w.flush()
file.close()

相关文章