更改 sys.defaultencoding 为文件的编码方式 #! /usr/bin/env python # -*- coding: utf-8 -*- import sys reload(sys) # Python2.5 初始化后删除了 sys.setdefaultencoding 方法,我们需要重新载入 sys.setdefaultencoding('utf-8')
done!