Python 列表list方法clear( )和直接list [ ]的区别

x.clear()是将内存地址清空,

x=[ ]会新开辟一个内存空间。

posted @ 2021-10-05 11:48  靠谱杨  阅读(276)  评论(0编辑  收藏  举报