1. Create a folder Nester for module Nester, which contains: nester.py (module file):
Copy Code code as follows:
"" "This is the" nester.py "module, which provides a function called the print_lol (),
function is to print list, temperament contains nested list "" "
def print_lol (the_list):
"" "This function takes a positional argument, named" The_list ", which can be any Python list
Each item of data in the specified list is output recursively to the screen, and the data items occupy one row ""
For Each_item in The_list:
If Isinstance (each_item,list):
Print_lol (Each_item)
Else:print (Each_item)
2. Create a new setup.py file in the Netster folder (containing the elements you want to publish):
Copy Code code as follows:
From Distutils.core Import Setup
Setup (name= ' Nester ',
Version= ' 1.0 ',
Py_modules= ' Nester ',
Author= ' Nidieya ')
3. Build the Publishing file:
"Head in the Python" is about the Linux environment in the release and construction of modules
The build module is experiencing problems under window:
If you enter Python in cmd, it does not show internal or external commands.
Add the Python installation directory to the system environment variable path. For example, installed in C:\Python33
My Computer icon right-click-> Properties-> advanced-> Environment variables
Open dialog box Double-click the path above, add C:\PYTHON33 to the column of the variable value, and note the semicolon;
The steps to release the module are available when the problem is resolved
Open the directory where Nester is located on the DOS command line
CD C:\nester I put it in the C root directory
Copy Code code as follows:
4. Post installation to your local Python copy
Copy Code code as follows:
After the module is published, you can import it using the