#!/usr/bin/env python3

# a for append and w for write(which will overwrite)
ifd = open('write.py', 'r')
contents = ifd.readlines()
ifd.close()
fd = open('out.txt', 'w')

fd.writelines(contents)
fd.close()