The es0EN2.7 implementation introduces its own class methods
- 2020-08-22 22:12:29
- OfStack
System environment: win10
Development environment: JetBrains PyCharm 2017.1.5 x64
Python version: 2.7
If we have an class called DBUtil, which is in A.py (preferably one py file for each class file, to be clear), it should have the init(self) function. It goes like this:
class DBUtil:
def __init__(self):
print ' Begin to build DBUtil'
If we need to use this class in other py files to generate the object of this class, we should import this class as follows:
from xxx.A import DBUtil
Where xxx is the path to the corresponding python package. Finally, have fun programming without bug.