Declaration of a variable:
The first character of a variable name cannot be a number,
Consists of letters, numbers, underscores
Avoid using keywords when declaring variables
Assignment of variables:
Assignment of variables: variable = ' content '
name1= "Content"
Name2= name1 (just assign the memory address that name1 points to name2)
--
name1 = ' Syl '
Name2 = name1
Output name1 and name2, output is Syl
Modify NAME1 Content
name1 = ' 123 '
In the output name2, the content or ' syl ' has not changed
Note: When re-assigned to NAME1, the original memory stored in the address content has not changed, but in memory to re-open a memory space to store new content, so the value of content 2 or point to the original memory address, so the output is name1 original content
! String attribute:! Once modified, recreate the memory space
Cases:
"Hello" + ' SB ' + ' Alex '
This situation takes up 3 blocks of memory space
"Hello"
"Hello" + ' SB '
"Hello" + ' SB ' + ' Alex '
Garbage collection mechanism for virtual machines: virtual machines are always running, automatic garbage collection mechanism, developers do not care about memory consumption and release
How many stages does a python file need to go through?
1. Loading memory, lexical analysis, parsing, compiling--bytecode--Execute byte code, generate machine code
2, byte code: ASCII, Unicode, Utf-8
3. argv built-in module
4. Default digital buffer pool size: -5~257
Process Control:
Process Control: 1.if else,if After comparison, you must write a colon: Indicates the end of the statement, if there is no curly brace in Python, you need to note
2. Multiple judgments can write else if if elif
Writing code in Python must be aware of indentation
Python Beginner Notes