Foreplay: The data series in Python is divided into variable (mutable) and immutable (immutable) two
Immutable: string, int, float, tuple
Feature: The same object occupies only one memory address, regardless of how many variables refer to it, such as A=1,b=1
Because it is immutable, each time a new object must be created, the Python garbage collection mechanism will automatically clean up if no references point to it.
Variable: list, Dict
Features: The same object, each reference it will open a new address in memory to save it, but when we operate on his value, the memory address is not changed
Summary: Immutable data types in Python Once the value of the variable is changed, it is equivalent to re-establish an object, so the memory address will also change;
The value of variable data type variables can be changed without causing changes in memory addresses, but if the value is referenced by multiple variables, each variable will open an address
One, a string (string) 1, a slice of str
(iv) "Four talents" in Python (strings, lists, dictionaries, collections)