Python del 关键字

ప్రయోగం

删除对象:

class MyClass:
  name = "John"
del myClass
print(myClass)

ప్రయోగం నిర్వహించండి

定义和用法

del 用于删除对象。在 Python,一切都是对象,因此 del 关键字可用于删除变量、列表或列表片段等。

మరిన్ని ప్రయోగాలు

ప్రయోగం

వెంబడి తొలగించండి:

x = "hello"
del x
print(x)

ప్రయోగం నిర్వహించండి

ప్రయోగం

జాబితాలో మొదటి అంశాన్ని తొలగించండి:

x = ["apple", "banana", "cherry"]
del x[0]
print(x)

ప్రయోగం నిర్వహించండి