I recently learned the Python language and encountered the conversion problem between data types. See an articleArticleThe summary is quite detailed.
Type conversion
Code
1 Function Description
2 INT (X [, base]) converts X to an integer.
3 Long (X [, base]) converts X to a long integer.
4 Float (x) converts X to a floating point number.
5 Complex (real [, imag]) creates a plural number
6 STR (x) converts object X to a string
7 Repr (x) converts object X to an expression string
8 Eval (STR) is used to calculate a valid Python expression in a string and return an object.
9 Tuple (s) converts the sequence s into a tuples
10 List (s) converts sequence s into a list
11 CHR (x) converts an integer to a character
12 Unichr (x) converts an integer to a Unicode Character
13 Ord (x) converts a character into its integer
14 Hex (x) converts an integer into a hexadecimal string.
15 Oct (x) converts an integer into an octal string
Sequential operation
Code
1 Operation description
2 S + R series connection
3 S * N, N * N copies of S, N is an integer
4 S % D string formatting (string only)
5 S [I] Index
6 S [I: J] Slice
7 X In S, X Not In S subordination
8 For X In S: Iteration
9 Len (s) Length
10 Min (s) minimum element
11 Max (s) maximum element
12 S [I] = X is assigned to s [I] again.
13 S [I: J] = R: assign a value to the list fragment.
14 Del S [I] deletes an element from the list.
15 Del S [I: J] deletes a clip from the list.
Numeric operation
Code
1 X < Y shifts left
2 X > Y shifts right
3 X & Y bitwise AND
4 X | Y by bit or
5 X ^ Y exclusive Or )
6 ~ X flip by bit
7 X + Yjia
8 X - Y minus
9 X * Y Multiplication
10 X / Y
11 X // Y floor Division
12 X ** Y multiplication (xy)
13 X % Y modulo (x mod y)
14 - X changes the symbol bit of the operand.
15 + X does nothing
16 ~ X ~ X =- (X + 1 )
17 ABS (x) absolute value
18 Divmod (x, y) returns (INT (x / Y), X % Y)
19 Pow (X, Y [, modulo]) returns (x ** Y) x % Modulo
20 Round (x, [N]) Rounding, n is the number of decimal places
21 X < Y is less
22 X > Y is greater
23 X = Y equals
24 X ! = Y is not equal <> Same)
25 X > = Y is greater than or equal
26 X <= Y is less than or equal