use*_*711 -1 python list python-3.x
请c = None在Python命令行中解释为什么在以下Python 3示例中.
>>> a = [1,2]
>>> b = a
>>> c = b.append(3)
>>> print(a,b,c)
[1, 2, 3] [1, 2, 3] None
Run Code Online (Sandbox Code Playgroud)
list.append()将该条目附加到位并返回Python所采用的任何内容(Python的None默认行为).例如:
>>> def foo():
... print "I am in Foo()"
... # returns nothing
...
>>> c = foo() # function call
I am in Foo()
>>> c == None
True # treated as true
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
77 次 |
| 最近记录: |