Python的逻辑操作有三种:and、or、not。分别对应与、或、非。
举例:
Python的逻辑操作有三种:and、or、not。分别对应与、或、非。
举例:
1 #coding:utf-8
2 test1 = 12
3 test2 = 0
4 print (test1 > test2) and (test1 > 14) #result = False
5 print (test1 < test2) or (test1 > -1) #result = True
6 print (not test1) #result = False
7 print (not test2) #result = True