In python, in addition to calling the downloaded extension library, you can also customize functions to facilitate yourself.
Put the basic module in a fixed folder (or relative fixed folder) and use sys.append(r'custom module path')
The example is as follows:
1. In E: \pycharmCreate a new hello.py to implement the basic function function (define a hello() function)
2. Call the custom function
3. The running result is:
For more Python related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of How to call a function written by yourself in python. For more information, please follow other related articles on the PHP Chinese website!