The following is a little similar to the three mesh operation, but not the same, really do not know how to draw up the title, the first is the title bar, we all know that there is no three-eye operation in Python, but and/or a bit similar to the three-mesh operation:
and/or
Use the expression logical relationship with and or separately, can also group and use, usage as follows
and
If a value is False (false, ', [], {}, None ...) Returns the first false value if all values are true returns the last truth
or
If or any of the values are true, returns this value immediately if all the values are false, or returns the last False value
Example
result = ' Test ' and true # result = True result
= ' test ' and ' ortest ' # result = ortest result
= False and ' Ortest ' # result = False result
= ' and None # result = ' result
= ' or ' hall ' # result = Hall result
= False or None # result = None result
= ' test ' or ' nottest ' # result = Test
To simulate a triple-mesh operation using a single line if else
Result if true/false else fresult if is true, results are result, and when false the results are Fresult
result = ' Test ' if True else ' don't test ' # result = ' Test ' result
= ' test ' if False Else ' not test ' # result = ' Not Te St