python: A method for determining whether tuple list dict are null
- 2020-12-26 05:49:38
- OfStack
Test
tuple_test = ()
assert not tuple_test
list_test = []
assert not list_test
dict_test = {}
assert not dict_test
Summary
According to the experimental results, it can be seen that:
if not xxx:
You can determine whether tuple, list, dict are empty.