用隐藏的空列表的布尔值才是最 Pythonic 的方法:
if not a: print("list a is empty")
虽然我自己一般用 len(a) == 0
len(a) == 0
Last updated 5 years ago
Was this helpful?