Write Unicode strings directly to flout : Encode File « Development « Python






Write Unicode strings directly to flout


import codecs
flout = codecs.open('uni.txt','w','latin-1','replace')

# 
flout.write(u' e')
flout.close()

           
       








Related examples in the same category

1.Encode file: latin