I am in the process of writing a script to check a table has been updated, but I am unsure how to implement the if else condition to check if A == True
.
So far, I have written the following code:
Would be a big help if someone can help me implement the if else condition to check A == True
.
CodePudding user response:
If A is true, then the code block of the if condition will be excepted. Otherwise( A not equals True), the else code block will be expected. If you don't have to do when A doesn't equal True, then you don't need to use else.
if A == True:
#Here write the code you want to be expected when A == True
else:
#Here write the code you want to be expected when A doesn't equal True.
CodePudding user response:
There's no need to go through all of the extra steps:
if df_check['last_day_loaded']==today_date:
print("It is equal to today's date")
else:
print("It's not equal to today's date")
Saying A = (df_check['last_day_loaded']==today_date)
already sets A to true if it is today's date, and checking A==true
is redundant.