方法一:(推荐)
line1 = "我爱中国111"
line2 = u"我爱祖国222"
with open('1.txt','w',encoding='utf-8') as f:
f.write(line2)
方法二:codecs
http://blog.csdn.net/mbugatti/article/details/53925236
import codecs
line1 = "我爱中国111"
line2 = u"我爱祖国222"
with codecs.open('1.txt', 'w', 'utf-8')as f:
f.write(line1)