Python-global variables, local variables, class variables, instance variables

Share a big cow's artificial intelligence tutorial. Zero-based! Easy to understand! Funny and humorous! Hope you join the artificial intelligence team too! Please click http://www.captainbed.net

Global variable

Variables inside the module, outside all functions, and all outside classes

 

Local variable

In the function or in the class method (class method, static method, instance method), and there is no modified variable before the variable

 

Class variable

Variables in the class and not in the methods of the class

 

Instance variable

In the class method, and use self-modified variables

Guess you like

Origin blog.csdn.net/chimomo/article/details/109817644