Do you mean somthing like this? >>> f = open("file.txt") >>> w = open('outfile.txt', 'w') >>> for line in f.split('\n'): ... w.write(line) ... >>> w.close() >>> '\n' in open('/home/wandleg/outfile.txt').read() False