ตัวแปร Dictionary เป็นตัวแปรแบบ Array โดยต้องมี Key และ Value คู่กันเสมอ การกำหนดค่าให้กับสมาชิกแต่ละตัวต้องอยู่ภายใต้ ' {...} '
การแสดงผลของตัวแปร Tuple นั้นจะแสดงผลเรียงลำดับ Index จากค่าน้อยไปหามาก และไม่สามารถระบุ Index ตามลำดับได้ ตัวแปรชนิด Dictionary ทำได้เพียงระบุ key ที่กำหนดไว้เท่านั้น
[attachment=3]การแสดงผลตัวแปร Dictionary.PNG[/attachment] [attachment=0]ผลลัพธ์การแสดงผลตัวแปร Dictionary.PNG[/attachment]
การเพิ่มค่า ยกเลิกค่าของตัวแปร Dictionary สามารถทำได้เช่นเดียวกันกันตัวแปร list
ฟังก์ชันการแปลงชนิดข้อมูล เพื่อให้สามารถนำไปใช้ตามความเหมาะสมกับการใช้งาน
[attachment=4]การแปลงชนิดข้อมูล.PNG[/attachment] [attachment=1]ผลลัพธ์การแปลงชนิดข้อมูล.PNG[/attachment]
ฟังก์ชัน Built-in ของตัวแปร List ได้แก่ cmp(list1,list2) , len(list) , max(list) , min(list) , list(seq)
[attachment=5]Built in list.PNG[/attachment] [attachment=2]ผลลัพธ์Built in list.PNG[/attachment]
ทำความรู้จักตัวแปร Dictionary และฟังก์ชันการแปลงชนิดข้อมูล
Moderator: mindphp, ผู้ดูแลกระดาน
-
- PHP Hero Member
- โพสต์: 114
- ลงทะเบียนเมื่อ: 09/04/2018 10:04 am
ทำความรู้จักตัวแปร Dictionary และฟังก์ชันการแปลงชนิดข้อมูล
- แนบไฟล์
-
- Built in list.PNG (6.18 KiB) Viewed 844 times
-
- การแปลงชนิดข้อมูล.PNG (6.8 KiB) Viewed 844 times
-
- การแสดงผลตัวแปร Dictionary.PNG (6 KiB) Viewed 844 times
-
- ผลลัพธ์Built in list.PNG (480 ไบต์) Viewed 844 times
-
- ผลลัพธ์การแปลงชนิดข้อมูล.PNG (1.78 KiB) Viewed 844 times
-
- ผลลัพธ์การแสดงผลตัวแปร Dictionary.PNG (2.94 KiB) Viewed 844 times
-
- Similar Topics
- ตอบกลับ
- แสดง
- โพสต์ล่าสุด
-
-
โพสต์ใหม่ แนะนำแอปพลิเคชันแปลภาษา U-dictionary
โดย norisa_dl » 22/04/2021 1:00 pm » ใน Microsoft Office Knowledge & line & Etc - 0 ตอบกลับ
- 2112 แสดง
-
โพสต์ล่าสุด โดย norisa_dl
22/04/2021 1:00 pm
-
-
-
โพสต์ใหม่ การใชังานตัวแปร dictionary ใน python
โดย ธวัชชัย แสนหาญ » 17/11/2018 6:19 pm » ใน Share Knowledge - 0 ตอบกลับ
- 1563 แสดง
-
โพสต์ล่าสุด โดย ธวัชชัย แสนหาญ
17/11/2018 6:19 pm
-
-
-
โพสต์ใหม่ มาทำความรู้จักกับ Dictionary ที่เป็นตัวแปรArray
โดย M033 » 27/01/2016 11:11 am » ใน Python Knowledge - 0 ตอบกลับ
- 1273 แสดง
-
โพสต์ล่าสุด โดย M033
27/01/2016 11:11 am
-
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 82