This section learns the data types of Python, first to learn simple data types, and other data types to be added later
1. String (str)
2. Numeric data type: shape (int), float (float), Boolean type (BOOL)
Shaping, floating-point, and string types can be converted to each other:
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/88/57/wKioL1fx8CSiMAhPAAAd7lOEUfQ185.png-wh_500x0-wm_3 -wmp_4-s_1383406739.png "title=" Class_convet.png "alt=" Wkiol1fx8csimahpaaad7loeufq185.png-wh_50 "/>
3. The scientific counting method of floating-point numbers:
A scientific notation for floating-point numbers using E or E
>>> 120E-1
12.0
>>> 120e-1
12.0
>>> 120e-2
1.2
That is, the E or E represented here represents 10 of the 1-10,e1, e-2 represents 10-2, so the floating-point 120e-2 means 120 times 10-2 times, and shrinks by 100 times.
4. Determine the type of data:
Python has built-in functions specifically designed to determine the type of data, type () and isinstance (). Python's official recommendation is to use Isinstance () to determine the data type.
1) type () Usage: The object name that is directly in parentheses with the type to be judged. The return value is directly the text of the description type.
For example:
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/88/57/wKioL1fx8kazEuEOAAAcRX2QRZs671.png-wh_500x0-wm_3 -wmp_4-s_3810414298.png "title=" Type.png "alt=" Wkiol1fx8kazeueoaaacrx2qrzs671.png-wh_50 "/>
2) isinstance () Usage: There are two parameters in parentheses, separated by commas, the first is the data to be judged, the second is the specified type, and its return value is a Boolean value.
Returns true if the data to be judged matches the specified type, or False if it does not match.
For example:
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/88/57/wKioL1fx80aATNghAAAWzTgV0bw224.png-wh_500x0-wm_3 -wmp_4-s_1968014654.png "title=" Isins.png "alt=" Wkiol1fx80aatnghaaawztgv0bw224.png-wh_50 "/>
This article is from the "Davidlee's Linux Road" blog, so be sure to keep this source http://davidlinux.blog.51cto.com/5965954/1858560
Python Basic Learning Notes (vi)