I. Numeric type
- Plastic
- Boolean type True and False is 1 and 0
- Floating point Type
- E notation E, for example 1.5e11 = 150000000000, 1e2 is the square of 1*10.
PS: Boolean types in Python can be added directly for example:
>>>true + True >>>2
Two. Type conversion
- Strings for numbers can be converted to integers using str ()
>>>a = ' 520 ' >>>b = Int (a) >>>b >>>520
- For shaping can also be converted into string type
>>>a = 520 >>>b = str (a) >>>a >>> ' 520′
- String type special floating point type
>>>a = ' 520′>>>b = float (a) >>>b 520.0
Three. Application of built-in functions
- The type function is used to determine what types of data the user gives
For example
>>>type (3.5) >>><class ' float ' >
>>>type (true) >>><class ' bool ' >
>>>type (5E15) >>><class ' float ' >
- Isinstance () built-in function for judging the data type and returning to the user a Boolean type of True or False
For a code case
>>>a = ' haha ' >>>isinstance (A,STR) True
>>> isinstance (320,int) True
>>>isinstance (A,int) >>>false
can also be directly used to judge
python[Little Turtle 005Python data type]