Python3 List clear()方法
Python 3 教程
· 2019-02-06 14:29:21
描述
clear() 函数用于清空列表,类似于 del a[:]。
语法
clear()方法语法:
list.clear()
参数
- 无。
返回值
该方法没有返回值。
实例
以下实例展示了 clear()函数的使用方法:
#!/usr/bin/python3
list1 = ['Google', 'Codercto', 'Taobao', 'Baidu']
list1.clear()
print ("列表清空后 : ", list1)
以上实例输出结果如下:
列表清空后 : []
点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html
HTML Dog
Patrick Griffiths / New Riders Press / 2006-11-22 / USD 49.99
For readers who want to design Web pages that load quickly, are easy to update, accessible to all, work on all browsers and can be quickly adapted to different media, this comprehensive guide represen......一起来看看 《HTML Dog》 这本书的介绍吧!