Python 3 phân loại kiểu dữ liệubuiltin thành các nhóm chính:
1. Kiểu số (Numeric)
int— số nguyên (không giới hạn độ lớn):10, -10, 0float— số thực dấu phẩy động:1.55, 0.005, -3.14complex— số phức:2+3j, 5.6-1.5jbool— logic:True, False(subclass của int)
2. Sequence (Có thứ tự)
str— chuỗi Unicode:'hello', "world", '''multi-line'''list— danh sách mutable:[1, 2, 'a', [3,4]]tuple— tuple immutable:(1, 2, 'a')range— dải số bất biến:range(10)bytes,bytearray,memoryview— dữ liệu nhị phân
3. Mapping
dict— từ điển key-value:{'a': 1, 'b': 2}
4. Set (Tập hợp)
set— mutable:{1, 2, 3}frozenset— immutable:frozenset([1,2,3])
5. None Type
NoneType— giá trịNone(null/nil)
Kiểm tra kiểu: type(x), isinstance(x, type).