kri*_*itz 0 python python-2.7 python-3.x
如何将空值附加到列表的开头?
输入:
t=[10,12,15,16]
Run Code Online (Sandbox Code Playgroud)
输出:
t=['null',10,12,15,16]
Run Code Online (Sandbox Code Playgroud)
t.insert(0, None) # to add a None value
t.insert(0, 'null') # to add the word 'null' as a string
Run Code Online (Sandbox Code Playgroud)
您可以将元素添加到第0个索引,如上所示.
| 归档时间: |
|
| 查看次数: |
631 次 |
| 最近记录: |