Python သည် List Item တစ်ခုကို ဖယ်ရှားပါ။
စာရင်းတစ်ခုအား ဖယ်ရှားပါ။
စာရင်းတစ်ခုမှ အရာများကို ဖယ်ရှားရန် နည်းလမ်းများစွာ ရှိပါသည်။
ဥပမာ
remove()
နည်းလမ်းသည် သတ်မှတ်ထားသော အကြောင်းအရာကို ဖယ်ရှားသည် -
thislist = ["apple", "banana", "cherry"]
thislist.remove("banana")
print(thislist)
ဥပမာ
နည်းလမ်းသည် သတ်မှတ်ထားသော အညွှန်းကို ဖယ်ရှား သည် pop()
၊ (သို့မဟုတ် အညွှန်းကို မသတ်မှတ်ထားပါက နောက်ဆုံးအရာ-
thislist = ["apple", "banana", "cherry"]
thislist.pop()
print(thislist)
ဥပမာ
del
သော့ချက်စကားလုံးသည် သတ်မှတ်ထားသော အညွှန်းကို ဖယ်ရှားသည် -
thislist = ["apple", "banana", "cherry"]
del
thislist[0]
print(thislist)
ဥပမာ
သော့ချက်စကားလုံး သည် del
စာရင်းကို လုံးလုံးလျားလျား ဖျက်နိုင်သည်-
thislist = ["apple", "banana", "cherry"]
del
thislist
ဥပမာ
နည်းလမ်း သည် clear()
စာရင်းကို ရှင်းထုတ်သည်-
thislist = ["apple", "banana", "cherry"]
thislist.clear()
print(thislist)