samedi 22 août 2020

Error when using two any functions in if condition

this is a very simple(may be silly) question.But I have been trying for an hour on this.Here is a invalid syntax statement i get ,when I use two if conditions with any function.Here is the statement I used.

if any(table in sentence for table in (alias_dict["tables"].strip('][').split(', ')))==False and if any(column in sentence for column in (alias_dict["columns"].strip('][').split(', ')))==True:
    print("Hii success")

But I am getting the error:

if any(table in sentence for table in (alias_dict["tables"].strip('][').split(', ')))==False and if any(column in sentence for column in (alias_dict["columns"].strip('][').split(', ')))==True: ^ SyntaxError: invalid syntax

Error (^) is shown near 'and'. I tried giving "&&" as well. I also tried giving paranthesis for whole any() as well.But it doesnt seem to work out.I know it might be a silly blunder from my part.Still Any help appreciated.

Aucun commentaire:

Enregistrer un commentaire