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