您首先需要声明一个编码,因为错误消息说得很清楚-
它甚至告诉您在这里查看详细信息!您的编码大概是
gb2312。
顺便说一句,这样做会更简单(使用相同的编码声明)
print u'哈哈'.enpre('utf-8')and you may not even need the
enprepart, if your
sys.stdouthas an
encodingattribute properly set (depends on your terminal, OS, etc).

您首先需要声明一个编码,因为错误消息说得很清楚-
它甚至告诉您在这里查看详细信息!您的编码大概是
gb2312。
顺便说一句,这样做会更简单(使用相同的编码声明)
print u'哈哈'.enpre('utf-8')and you may not even need the
enprepart, if your
sys.stdouthas an
encodingattribute properly set (depends on your terminal, OS, etc).