如何检查python中的错误情况

时间:2017-03-02 07:39:51

标签: python

我有一个非常简单的初学者的问题。我正在使用python在服务器上重写一个PHP脚本,我不知道如何将这个PHP代码翻译成python:

if(a && b && c && (!d || !e) doThis()

对于python,我只知道如何以相反的方式做到这一点

if a and b and c and (d or e):
    doThis(etc)

如何查看**NOT** d**NOT** e

1 个答案:

答案 0 :(得分:1)

有很多方法,还有很多其他帖子,您只需要进行简单的谷歌搜索即可找到。

if not a and not b and not c: 
    doThis()