Python-编写utf-8签名整数

时间:2013-07-16 13:33:58

标签: python utf-8

我正在尝试以.fits格式编写一个文件,我最好能说这个文件需要utf编码,最好是utf-8。如何在utf-8中为文件写一个整数?

1 个答案:

答案 0 :(得分:1)

How to encode a string in utf8 for std out:

myString = "string"
string.encode('utf8')

A python post by Jon Skeet on how to write to a file with utf8:

import codecs
file = codecs.open("lol", "w", "utf-8")
file.write(u'\ufeff')
file.close()