I. Overview of Python built-in types:
(1) Main data types include: Numerics (number), sequences (sequence), ings (ing), classes, instances and exception.
(2) Features: All standard objects can be used for Boolean testing, compared between the same type, and converted to string (using the built-in function repr (obj) or str (obj )).
* Any object can test the true value in an if, while, or Boolean expression. The following values are considered false (others are true ):
* Boolean operator:
* Python has eight comparison operators with the same priority (higher than boolean operators ): <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + pgltzybzcm9 "http://www.bkjia.com/uploadfile/Collfiles/20131223/20131223095211300.jpg" alt = "">
(3) classification of standard types:
* Variable type: Numbers and dictionaries
* Unchangeable types: Numbers, strings, and tuples
2 Numeric (number) type -- int, float, complex
(1) Integers (integer ):
(2) Floating point number (double-precision Floating point type): usually implemented using double in c.
(3) Complex number (plural ):
* Example: comp = 12 + 2j
* Note: The imaginary part must have a suffix j or J.
* You can use *. real to return the real part; *. imag to return the virtual part.
Trisequence Sequence type:
(1) python has six sequence types: strings, list, tuples, range, byte sequences (bytes object), and byte arrays (bytearray objects ).
(2) String
(3) List
(4) tuples
Four Set types:
(1) The set object is an unordered hash object.
(2) There are two built-in set types: set and frozenset.
* Set is a variable set: You can add or delete elements, but not hash elements.
* Frozenset is an unchangeable set: It can be hashed.
Five ing types -- dict:
Six other built-in types: