我需要在Python 2.7生成的报告中显示“Δreturn”。 但是,打印时出现以下错误。如何运作?
print u"Δ"
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0394' in position 8: ordinal not in range(128)
print u"Δ".encode('utf-8')
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0394' in position 2: ordinal not in range(128)
print u"Δ".decode('utf-8')
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0394' in position 2: ordinal not in range(128)
这些是How do I write a capital Greek "delta" as a string in Python 2.7?
中建议的方法