This article mainly records the basics of Python.
First, Python basic input and output statements
1. Print () function: printed output. Integer, floating-point, string
Print () formatted output:
Print (Format (var,format_modifier)): var value, format_modifier format Word
such as print (Format (12.34567, ' 6.2f ')): 6 output placeholder, 2 accuracy
Print (Format (0.3456, ' 3.2% ')): 3 for placeholder, 2 for precision, left/right aligned output/output 34.56%
2, Raw_input () function: input.
Syntax: Raw_input ([Prompt]), string
So enter a number, get a string, want to become integral type, must be converted, such as Age=int (raw_input ("Input your Age:"))
conversion function: Int (), float ()
Second, the variable analysis
1, the "change" of the Python variable, the ID
You cannot modify the contents of a data cell by its variable name
2. Python data type does not need to specify type
3. Compare the C variable to the Python variable
Third, Python functions
1. The System library provides internal functions
Character function library: str
Math Library: The math library is not the default library, it needs to be imported, import math
OS Library
Network Programming Library: Socket Library
......
2. Functions provided by third parties: HTTPLIB2
Installing a third-party-supplied library procedure: Easy_install HTTPLIB2
(1)
3. Custom Functions
Python Basic Notes