How to create an 'empty if statement' in python

后端 未结 4 955
别那么骄傲
别那么骄傲 2020-12-05 17:45

It\'s very common in C: hacking \'empty if statement\' like this:

if(mostlyhappencondition)
    ;#empty statement
else{
    dosomething;
}

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-05 17:56

    Till the time you dont have any thing in if True: you could do

    if not mostlyhappenedcondition:
       do something()
    

    If you dont have to put any thing in "if" even in future, then it is redundunt in your code.

提交回复
热议问题