mercredi 22 janvier 2020

Why I can't use if statements in except statements?

Why can't I add an if statement in except statements?

I want to show both forms of this kind of error in the output:

except ValueError:
        if t == float:
            print(">>> you should give a int number (you given float) <<<\n")
        elif t == str:
            print(">>> you should give a int number (you given str) <<<\n")

Aucun commentaire:

Enregistrer un commentaire