with open('file.txt', 'w', encoding='utf-8') as f: f.write('Hi EveryOne')
import codecs file = codecs.open("lol", "w", "utf-8") file.write(u'ufeff') file.close()