รายการ Python ลบ ()วิธีการ
ตัวอย่าง
ลบองค์ประกอบ "กล้วย" ของfruit
รายการ:
fruits = ['apple', 'banana', 'cherry']
fruits.remove("banana")
ความหมายและการใช้งาน
วิธี การremove()
ลบการเกิดขึ้นครั้งแรกขององค์ประกอบด้วยค่าที่ระบุ
ไวยากรณ์
list.remove(elmnt)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
elmnt | Required. Any type (string, number, list etc.) The element you want to remove |