variable, buffer value, encoding
--Tao Xin
Variable
declaring variables
eg
#!/usr/bin/env python
#-*-Coding:utf-8-*-
Name = "Daoxin"
The code above declares a variable named: Name, and the value of the variable name is: "Daoxin"
The role of a variable: a nickname that refers to what is stored in an address in memory
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 ', ' F ' Rom ', ' Global ', ' if ', ' import ', ' in ', ' was ', ' lambda ', ' not ', ' or ', ' pass ', ' print ', ' raise ', ' return ', ' try ', ' while ', ' WI Th ', ' yield ']
C language, no strings, only characters, arrays
Hello---Five character (s)
Forge a string character array with a character array [' H ', ' e ', ' l ', ' l ', ' O ']
String attributes, once modified, re-created
Buffer
A certain buffer value in Python
eg
Define two variables I1 and I2
>>> i1=100
>>> i2=100
Input: ID (i1), ID (i2)
Output: (1501868224, 1501868224)
Assign value again
>>> i1=1
>>> i2=1
Input: ID (i1), ID (i2)
Output: (1501865056, 1501865056)
string, with buffer value, within a certain range, ID, over range, not the same, digital buffer value-5 to 257
Steps taken by Python file execution
Load Memory >>> Lexical analysis >>> parsing >>> compiling >>> bytecode >>> executing bytecode >>> machine code >>> Execute machine code
Coding
Ascii
(American Standard Code for Information interchange, United States Standards Information Interchange Code) is a Latin alphabet based computer coding system, mainly used to display modern English and other Western European languages, which can only be represented by a maximum of 8 bits (one byte) , that is: 2**8 = 256, so the ASCII code can only represent 256 symbols.
Unicode
Unicode (Uniform Code, universal Code, single code) is a character encoding used on a computer. Unicode is created to address the limitations of the traditional character encoding scheme, which 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
UTF-8
UtF-8, which is compression and optimization of Unicode encoding, does not use a minimum of 2 bytes, but instead classifies all characters and symbols: the contents of the ASCII code are saved with 1 bytes, the characters in Europe are saved in 2 bytes, and the characters in East Asia are saved in 3 bytes ...
variable, buffer value, encoding