1.Python supports five basic number types, three of which are integral types
(1) Int integer
(2) Long integer type
(3) Boolean bool
(4) floating-point type floating-point
(5) plural complex
Model 2.int
Standard integer type
(1) Decimal
(2) 2 binary is starting with 0b:
For example: 0B11 represents 3 of the decimal
(3) 8 binary is preceded by 0:
For example: 011 indicates a decimal 9
(4) 16 binary is starting with 0x:
For example: 0x11 represents 17 of the decimal
3. Digital
4. Sequence
(1) string
Use raw String (original string)
>>> Myfile=open (R ' C:\new\test.txt ', ' W ')
Use the escape character \
>>> myfile=open (' C:\\new\\test.txt ', ' W ')
(2) List
(3) Meta-group
5. Mapping type
To create a dictionary:
>>> a = Dict (one=1, two=2, three=3)
#dict () factory functions are used to create dictionaries
>>> B = {' One ': 1, ' both ': 2, ' Three ': 3}
>>> C = dict (Zip ([' One ', ' B ', ' three '), [1, 2, 3])
>>> d = dict ([' One ', 1), (' Three ', 3)])
>>> e = dict ({' Three ': 3, ' one ': 1, ' One ': 2})
>>> A = = b = = C = = d = E
True
6. Set (SET)
7. Documents
(1) Storage model
? Atomic Storage (scalar):
The type number of a single Literal object, String (why is the string not a container type?) Python does not have a char type)
? Container Storage (Container):
? A type list, a tuple, a dictionary that holds multiple objects
(2) Updating the model
Immutable types: Numbers, strings, tuples
Mutable type: list, dictionary
(3) Accessing the model
Direct access: Digital
Sequential access: strings, lists, tuples
Map Access: Dictionaries
Python data type