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