Python file write operations.
Program in Python to open and write file
This program writes to the file specified with-
import sys
import os
import string
def write_file(file):
file_to_write = open('test_write.txt', 'w')
file_to_write.write('Text to write')
file_to_write.close()
file = write_file(open('test_write.txt', 'w'))
Now lets make the file writes to be more interesting