selfteaching / selfteaching/selfteaching-python-camp
Day03 编码错误 NON-ASCII CHARATER ‘\xe9’
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 151
- Forks
- 875
- PR merge metrics
- No merged PRs in 30d
Description
代码如下
def add(x, y):
return x+y
def sub(x, y):
return x-y
def mul(x, y):
return x*y
def div(x, y):
return x/y
print("选择运算:\n1、相加\n2、相减\n3、相乘\n4、相除")
choice = input("输入你的选择(1/2/3/4):")
num1 = int(input("输入第一个数字:"))
num2 = int(input("输入第二个数字:"))
if choice == '1':
print(num1, "+", num2, "=", add(num1, num2))
elif choice == '2':
print(num1, "-", num2, "=", sub(num1, num2))
elif choice == '3':
print(num1, "*", num2, "=", mul(num1, num2))
elif choice == '4':
print(num1, "/", num2, "=", div(num1, num2))
else:
print("非法输入")
错误如下

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the calculator code with the Python interpreter and inspect how the source file is saved and decoded. Confirm the interpreter version and source encoding involved in the NON-ASCII CHARATER error; it is done when the posted program runs without that encoding error and accepts its documented choices.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100