filename = 'python.txt' # python写入日志文件一行一条 写文件换行 with open(filename, 'w') as file_object: file_object.write("python写入文件\n") file_object.write("python写入文件\n") file_object.write("python写入文件\n")