小白教程
所有教程
关于
Search
172.70.130.73
172.70.130.73
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Python3 att list clear”的源代码
本页内容
上一节:
Python3_att_list_sort
下一节:
Python3_att_list_copy
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:list.clear()}}[[Category:python3 list|14]] = Python3 List clear()方法 = [[python3 list|Python3 列表]] == 描述 == clear() 函数用于清空列表,类似于 '''del a[:]'''。 == 语法 == clear()方法语法: <sample title="" desc="" lang="python" hererun="1"> list.clear() </sample> == 参数 == * 无。 == 返回值 == 该方法没有返回值。 以下实例展示了 clear()函数的使用方法: <sample title="" desc="" lang="python" hererun="1"> #!/usr/bin/python3 list1 = ['Google', 'xiaoBai', 'Taobao', 'Baidu'] list1.clear() print ("列表清空后 : ", list1) </sample> 以上实例输出结果如下: <sample title="" desc="" lang="python" hererun="1"> 列表清空后 : [] </sample> [[python3 list|Python3 列表]]
返回至“
Python3 att list clear
”。
上一节:
Python3_att_list_sort
下一节:
Python3_att_list_copy