In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "introduction to the concept and attributes of Python module". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
A module module is a file that contains defined functions and variables, followed by a .py name. The module can be introduced by other programs to use functions and other functions in the module. This is also the way to use the python standard library. Import module import statement interpreter encounters import statements and searches under the current search path. If the module is in the directory, it will be imported. The search path contains the directory of the current project and the directory established at the time of python installation, that is, the environment variables of the current editing file can be viewed by sys.path: import module1 Note: if there is a file with the same name as the module to be imported in the current directory, the module to be imported from will be blocked. Import... Statement this statement is used to import the specified part from the module, not the entire module, but module itself will not be placed in the current character table Note: use from. Import... Statement, import can be followed by submodules, subpackages, or functions, classes, and variables within the module. The import statement must be followed by a module (sub-module) example: from module import * # imports all functions and variables from module, except for the variables that begin with _ and the properties of the function module name properties module itself runs, _ _ name__ value is _ _ main__ module is called, _ _ name__ value is the module name dir () function dir (modulename) is used to query all the names defined in the module When private variables and functions containing function name and variable name module are imported into the module using import modulename, the private properties of the module and the function are not imported in the way of from modulename import *, and the _ _ init__.py file contained in the function package directory is treated as a package to define a _ _ all__ variable in the _ _ init__.py file, and when the package is imported Import the name contained in the _ _ all__ variable if _ _ all__ is not defined, using from module import will only import the contents of the definition in _ _ init__. " This is the end of the introduction to the concepts and properties of the Python module. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.