ly-chengwu 发表于 2020-3-10 09:19:33

为什么下面两行的输出不一样?

old =
A = old.clear()               
print(old)
print(A)

zltzlt 发表于 2020-3-10 09:20:44

old.clear() 没有返回值,它只能用在原来的列表上,比如:

>>> a =
>>> a.clear()
>>> a
[]
页: [1]
查看完整版本: 为什么下面两行的输出不一样?