รายการหลามผนวก ()วิธีการ
ตัวอย่าง
เพิ่มองค์ประกอบในfruits
รายการ:
fruits = ['apple', 'banana', 'cherry']
fruits.append("orange")
ความหมายและการใช้งาน
วิธี การappend()
ผนวกองค์ประกอบที่ส่วนท้ายของรายการ
ไวยากรณ์
list.append(elmnt)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
elmnt | Required. An element of any type (string, number, object etc.) |
ตัวอย่างเพิ่มเติม
ตัวอย่าง
เพิ่มรายการในรายการ:
a = ["apple", "banana", "cherry"]
b = ["Ford", "BMW", "Volvo"]
a.append(b)