Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
从 Odoo 11 中的编码角度来看,与 Odoo 10 相比,异常有什么不同?找不到其他差异 ,除了 Exception, e: to except Exception as e: My code 在将模块从 Odoo 10 转换为 Odoo 11 时以某种方式显示异常错误。
在 Python 2.5 及更早的版本中,不支持 'as',因此您使用except Exception,e:
在 Python 2.6+ 版本中,两者都可以使用。
但是从 Python 3.x 开始,除了 Exception as e 需要将异常分配给变量。