csdnwucaishi 2023-04-10 20:25 采纳率: 50%
浏览 24

python语法错误未声明变量,但没找到哪出问题

总是报错SyntaxError: Non-UTF-8 code starting with '\xa3' in file C:\Users\70686\source\repos\PythonApplication3\PythonApplication3\PythonApplication3.py on line 3, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
下面是写的代码

price = 0
amount = 0
weight = int(input("plese enter weight:"))
where=input("please enter place:")

where1="dongsansheng"or"qinghai"or"ningxia"or"hainan"
fprice1=12
eprice1=10

where2="xinjiang"or"xizang"
price2=20

where3="hongkong"or"aomen"or"taiwan"or"oversea"

if weight<=3:
    if where==where1:
        amount=fprice1*weight
    if where==where2:
        amount=price2*weight
    if where==where3:
        print("shipments from this area will not be accept")
if weight>3:
    if where==where1:
        amount=fprice1*3+eprice1*weight-eprice1*3
    if where==where2:
        amount=price2*weight
    if where==where3:
        print("shipments from this area will not be accept")
print("sent to the place:",where,"courierweight:",weight,"amount:",amount)

  • 写回答

2条回答 默认 最新

  • threenewbee 2023-04-10 20:56
    关注

    代码文件保存为 urf-8

    评论

报告相同问题?

问题事件

  • 创建了问题 4月10日

悬赏问题

  • ¥50 我在一个购物网站的排队系统排队,这个排队到号后重新定向到目标网站进行购物,但是有技术牛通过技术方法直接跳过排队系统进入目标网址购物,有没有什么软件或者脚本可以用
  • ¥15 ios可以实现ymodem-1k协议 1024字节传输吗?
  • ¥300 寻抓云闪付tn组成网页付款链接
  • ¥15 请问Ubuntu要怎么安装chrome呀?
  • ¥15 视频编码 十六进制问题
  • ¥15 Xsheii7我安装这个文件的时候跳出来另一个文件已锁定文件的无一部分进程无法访问。这个该怎么解决
  • ¥15 unity terrain打包后地形错位,跟建筑不在同一个位置,怎么办
  • ¥15 FileNotFoundError 解决方案
  • ¥15 uniapp实现如下图的图表功能
  • ¥15 u-subsection如何修改相邻两个节点样式