python编译错误

  • IndentationError: unexpected indent
    字符缩进问题,可能是缩进格式不对,或者有空格。建议改用Tab标准缩进

  • SyntaxError: invalid syntax
    使用python关键字作为变量

  • SyntaxError: Missing parentheses in call to ‘print’
    源码为2.x环境,当前运行环境为3.x。在2.x中print函数为 print “text”,3.x中改为 print(“text”)

  • inconsistent use of tabs and spaces in indentation
    空格与Tab混用,统一用Tab或4个空格

  • TypeError: a bytes-like object is required, not ‘str’
    类型错误,在这里需要一个bytes类型数据,而不是一个字符串(str)

  • ‘bytes’ object has no attribute ‘encode’
    bytes对象没有对应的encode属性,应该改为decode
    只能对其编码,而不能解码

  • XX missing 1 required positional argument:XXX
    表示函数缺少一个必要的参数,可能是传参的类型不对应导致

  • takes 1 positional argument but 2 were given
    参数给多了

  • ‘NoneType’ object has no attribute ‘XXX’
    操作的对象为空,没有任何属性

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值