import cmath
import math
import sys
import io
print("ax\N{SUPERSCRIPT TWO} + bx +c =0")
----运行的时候会报错
print("ax\N{SUPERSCRIPT TWO} + bx +c =0")
UnicodeEncodeError: 'gbk' codec can't encode character '\xb2' in position 2: illegal multibyte sequence
在网上查找添加了后
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, errors = 'replace', line_buffering = True)
打印为:
ax? + bx +c =0
怎样才会正确的显示
ax2 + bx +c =0
转载于:https://blog.51cto.com/duany/1307344