>>> def oj(t):
... if t is None:
... print("this is None")
... elif t:
... print("this is True")
... else:
... print("this is False")
...
1
2
3
4
5
6
7
8
进行数据测验:
>>> oj(None)
this is None
>>> oj(True)
this is True
>>> oj(False)
this is False
>>> oj(0)
this is False
>>> oj(0.0)
this is False
>>> oj([])
this is False
>>> oj(())
this is False
>>> oj({})
this is False
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16