gpt4 book ai didi

python - 列表理解返回值加上 [None, None, None],为什么?

转载 作者:太空狗 更新时间:2023-10-30 00:20:40 29 4
gpt4 key购买 nike

<分区>

我正在学习理解。我得到了 print(x) 部分(我想。它打印了通过“in”测试的 x 的值)但为什么它之后还返回一个 None 列表?

>>> g
['a', 'x', 'p']

>>> [print(x) for x in g]
a
x
p
[None, None, None] #whats this?

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com