In [1]:
lines = ['first line\n', 'second line\n', 'third line\n']
f = open('t1.txt', 'w')
f.writelines(lines)
f.close()
In [2]:
f2 = open('t2.txt', 'wb')
f2.writelines(lines)
f2.close()