Built-in Functions
Python มี built-in functions มากมายที่พร้อมใช้งานทันทีโดยไม่ต้อง import เป็นเครื่องมือพื้นฐานที่ทุก Python developer ควรรู้จักและใช้เป็น เพราะช่วยให้โค้ดกระชับ อ่านง่าย และทำงานได้เร็วขึ้น
ทำไมต้องรู้ Built-in Functions
Section titled “ทำไมต้องรู้ Built-in Functions”Built-in functions มีข้อดีหลายประการ:
- พร้อมใช้งานทันที - ไม่ต้อง import module ใดๆ
- Optimized Performance - เขียนใน C ทำงานเร็วกว่า pure Python code
- Standard และ Pythonic - เป็น idiom ที่ทุกคนเข้าใจ
- Tested และ Reliable - ผ่านการทดสอบมาแล้ว
- Well Documented - มี documentation ชัดเจน
หมวดหมู่ของ Built-in Functions
Section titled “หมวดหมู่ของ Built-in Functions”| Category | Functions | Description |
|---|---|---|
| Type | type, isinstance, callable | ตรวจสอบชนิดข้อมูล |
| Conversion | int, str, list, float, bool | แปลงชนิดข้อมูล |
| Math | abs, round, sum, min, max, pow | คำนวณทางคณิตศาสตร์ |
| Sequence | len, range, enumerate, zip, sorted | จัดการ sequence |
| Logic | all, any | ตรรกศาสตร์ |
| Higher-Order | map, filter, reduce | ฟังก์ชันระดับสูง |
| I/O | print, input, open | รับ-ส่งข้อมูล |
| Attributes | getattr, setattr, hasattr, delattr | จัดการ attributes |
เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google