Home > Article > Backend Development > About python underscore usage scenarios
Python provides multiple libraries for graphical development interfaces. This article will introduce you to the usage scenarios of python underline.
_var
Usage scenario: Only Internal use, such as functions and variables used only within the class Note: wildcard import: from module import * will not import objects with a single leading underscore
var_
Usage scenario: The most appropriate name of a variable has been occupied by a keyword, and you still want to use it, you can append an underscore to solve the naming problem ConflictFor example:
class_ ,
id_
__var
_classname__var. Simply put, just like private variables in c, it is completely transparent to subclasses and the outside. Not referenceable
Usage scenarios: Generally an object is very important and does not want to be directly referenced by subclasses or external sources
__var__
__init___,
__call__, etc.
is not recommended to use # in your own code
: Identifies a temporary or insignificant variable, often used in unpacking expressionsFor example: age is not important
name_age_id = ('醉陌', '20', '21315271927') name, _, id_ = name_age_id
Related recommendations:
MySQL Connector/Python for Python 3.3_MySQL[python tutorial] python GUI programming (Tkinter)The above is the detailed content of About python underscore usage scenarios. For more information, please follow other related articles on the PHP Chinese website!