删除集合
删除集合详细操作教程
以下实例为学习删除集合,具体代码如下:
# Filename : example.py
# Author by : www.lidihuo.com
thisset = {"apple", "banana", "cherry"}
del thisset
print(thisset) #this will raise an error because the set no longer exists
执行以上代码输出结果为:
# Filename : example.py
# Author by : www.lidihuo.com
Traceback (most recent call last):
File "demo_set_del.py", line 5, in <module>
print(thisset) #this will raise an error because the set no longer exists
NameError: name 'thisset' is not defined