1. Create dir "Nester" under C:\Users\eric\AppData\Local\Programs\Python\Python35-32\
2. Create a nester.py under C:\Users\eric\AppData\Local\Programs\Python\Python35-32\nester\
"" "This is a new fuction, the which work for a list" "" Def Print_lol (the_list): "" "one arguement are The_list" "" For ea Ch_item in The_list: if Isinstance (each_item,list): print_lol (Each_item) else: print (Each_item)
3. Run F5, the Python parser resets, loads the new function
4. Create setup.py under C:\Users\eric\AppData\Local\Programs\Python\Python35-32\nester\
From Distutils.core import setupsetup ( name = ' Nester ', version = ' 1.0.0 ', py_modules = [' Nester '], author = ' Eric ', author_email= ' [email protected] ', url = ' http://126.com ', Description = ' A simple nested lists ', )
5. Create distribution under CMD or Shell
c:\users\eric\appdata\local\programs\python\python35-32\nester>c:\users\eric\appdata\local\programs\python\ Python35-32\python.exe setup.py sdistrunning sdistrunning checkwarning:sdist:manifest template ' manifest.in ' does not E Xist (using default file list) Warning:sdist:standard file not Found:should has one of the README, readme.txtwriting manife St file ' MANIFEST ' creating nester-1.0.0making hard links in Nester-1.0.0...hard linking nester.py-Nester-1.0.0hard l Inking setup.py, nester-1.0.0creating distcreating ' dist\nester-1.0.0.zip ' and adding ' nester-1.0.0 ' to itadding ' NE ster-1.0.0\nester.py ' adding ' nester-1.0.0\pkg-info ' adding ' nester-1.0.0\setup.py ' removing ' nester-1.0.0 ' (and Everything under it)
6. Install Nester Moudle to your local
c:\users\eric\appdata\local\programs\python\python35-32\nester>c:\users\eric\appdata\local\programs\python\ Python35-32\python.exe setup.py installrunning installrunning buildrunning build_pycreating buildcreating build\ Libcopying nester.py, build\librunning install_libcopying build\lib\nester.py, c:\Users\eric\AppData\Local\ Programs\python\python35-32\lib\site-packagesbyte-compiling c:\Users\eric\AppData\Local\Programs\Python\ python35-32\lib\site-packages\nester.py to nester.cpython-35.pycrunning install_egg_infowriting c:\Users\eric\ Appdata\local\programs\python\python35-32\lib\site-packages\nester-1.0.0-py3.5.egg-info
7. Import and test new Moudle
>>> import nester>>> cast = [' Palin ', ' Cleese ', ' book ', ' Jones ']>>> print_lol (CAST) Traceback (most recent): File "<pyshell#3>", line 1, in <module> print_lol (cast) Nameerror:name ' Print_lol ' is not defined>>> nester.print_lol (cast) palincleesebookjones>>>
Python Create a distribution for your moudle and func