Data Type in python, python Data Type
1. Number
Integer int: for example, 2
Long: A long integer.
Floating point float: 3.23 and 52.3E-4. E indicates the power of 10. Here, 52.3E-4 indicates 52.3*10-4
Plural complex :(-5 + 4j) and (2.3-4.4.7), where-5 and 4 are real numbers and j are virtual numbers.
2. Boolean Value
True or false 1 or 0
3. String
Definition: it is a collection of ordered characters. It is used to store and represent basic text information ''or" ". The content contained in it is called a string.
Supplement: the single and double quotation marks of a string cannot cancel the meaning of special characters. If you want to cancel the special meaning of all characters in the double quotation marks, add r before the quotation marks, for example, name = r'l \ thf'
Common functions: Remove blank, split, length, index, and slice
4. List
Definition: separated by commas (,) in [], stores various data types by index. Each position represents an element, and the subscript starts from 0.
Create a list: name_list = ['M', 'seven', 'Eric ']
Basic operations: Index, slice, append, delete, length, slice, loop, including
5. tuples (unchangeable List)
Create tuples: ages = (11, 22, 33, 44, 55)
6. Dictionary (unordered)
Definition: {key1: value1, key2: value2}, key-value structure, key must be hash
Create a dictionary: person = {"name": "mo", 'age': 18}