examples/files/write.py
filename = 'data.txt'

with open(filename, 'w') as out:
    out.write('text\n')