为什么一组虚假的物体是真实的?

2024-04-20 01:50:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我在最近的一个项目中遇到了这个问题,我很好奇为什么会这样。你知道吗

test_ = None
test_1 = []
test_2 = ([], None)

if test_:
    print('hello')

if test_1:
    print('hello')

if test_2:
    print('hello')
> hello

Tags: 项目testnonehelloifprint