First, the programming language:
1. Compiled (the source code is converted into executable code according to the runtime's precompilation, the runtime does not need to be compiled, not portable) and interpreted (easy to transplant, slow)
2. Static language (data type checking during compilation) and dynamic language (run-time check)
3. Strongly typed definition language (variable type cannot be changed without coercion after a variant is specified) and weak type definition language (variables can assign values of different data types)
python-dynamic explanatory type strong type definition language
Second, Python3 everything is Unicode
Iii. Variables and constants
Variable: Access--"call
Rules for variable definitions:
Variable names can only be any combination of letters, numbers, or underscores
The first character of a variable name cannot be a number
The following keywords cannot be declared as variable names
[
' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ', ' Def ', ' del ', ' elif ', ' Else ', ' except ', ' exec ',
' Finally ', ' for ', ' from ', ' global ', ' if ', ' import ', ' in ', ' was ', ' lambda ', ' not ', ' or ', ' pass ', ' print ',
' Raise ', ' return ', ' try ', ' while ', ' with ', ' yield ']
Constant capital letters
Four, character encoding
When the Python interpreter loads the code in the. py file, the content is encoded (the default Ascill,ascii code can represent up to 255 symbols, and one character occupies 1 bytes and 8 bits)
UP compatible
Ascill
gb2312 7445 Embedded Devices
GBK 2w+ pc
GB18030 27xxx
Utf-8 en 1byte zh 3byte
Unicode (Uniform Code, universal Code, single code) is a character encoding used on a computer. Unicode is created to address the limitations of traditional character encoding schemes,
It sets a uniform and unique binary encoding for each character in each language, which specifies that characters and symbols are represented by at least 16 bits (2 bytes), that is: 2 **16 = 65536
V. Notes
When the line comment #xxx
Multi-line comment ' ' xxx '
VI. Input
String input
Raw_input 2.x Input 3.x
Password input (ciphertext)
Import Getpass
passwd = Getpass.getpass ("passwd:")
Seven, circulation
1. If...else ... Matching appears
2. For...else
s = ["a111", "b222", "c333", "d444", "e555"]
For C in S:
If C.startswith ("C"): print "find" breakelse:print "not Found" does not need to set the extra variable flag to see if C begins with item 3. While...else usage is similar
The path of Python, day1