python common operators
1. Member Relationship Operators
inch
not in
The Python membership operators have in and not in, and they are used to determine whether an element is in a container (string, collection, dictionary, list, tuple), if it returns true, if not, returns false
2. Arithmetic Operators
Symbolic Meaning
+ addition
- subtraction
* multiplication
/ Division (real Division)
% redundancy
* * Power Operation
// Division (floor except)
3. Comparison Operators
Symbolic Meaning
< less than
<= less than or equal to
> greater than
>= greater than or equal to
= = Test equal
! = Test Unequal
4. Logical Operators
Symbolic Meaning
and Logic and
or logical OR
not logical non-
5. Format operator%
#1. Formatting symbols
Symbolic Meaning
%c formatted character and its ASCII code
%s formatted string
%d formatted integer
%o formatting unsigned octal numbers
%x format unsigned hexadecimal number
%x format unsigned hexadecimal number (uppercase)
%f format floating-point numbers to specify the precision after the decimal point
%e format floating-point numbers with scientific notation
%E function with%E
%g use%f or%e depending on the size of the value
%G function with%G
#2. Formatting operator Auxiliary Instructions
Symbolic Meaning
M.N m is the smallest total width displayed, and n is the number of digits after the decimal point
- result left aligned (default right justified)
+ show plus sign in front of positive number
# display ' 0o ' before octal number, ' 0x64 ' or ' 0x64 ' in hexadecimal front
0 display numbers preceded by ' 0 ' instead of spaces
6. Escape character
Symbolic Meaning
\ ' single quotation mark
\ " double quotation marks
\a emits system ring tones
\b backspace
\ n line break
\ t horizontal tab TAB
\v Portrait tab
\ r return character
\f page Break
\o The characters represented by the octal number
\x hexadecimal number represents the character
\ s represents a null character
\ \ counter slash
Python Common operators