1.publish
2.update Print_lol
Ps:
For Step 1.
Write the code in to a py file. Put the py file into a folder named Nester. New a py file named ' Setup ' and the content as below:
Setup (name='Nester', Version='1.0.0', Py_modules= ['Nester'], author='Myfirstpython', Author_email='[email protected]', the URL='Http://XXXX', Description='A Simple Demo of Python', )
Put the folder Nest Upder the folder ' Python34 '. Run a Windows command line and run the Command:python setup.py sdist
Get the screenshot as Delow:
Finally, install the problem.
Now, all we can go to IDLE and use this funtion.
>>> a=['asd', ['wef', ['ergre '],'wefw'],'asd' Import nester>>> nester.print_lol (a) ASDWEFERGREWEFWASD
for function override. Edit the source code file and put the code below into the file.
def print_lol (the_list,level=0): for each in The_list: if Isinstance (each,list): Print_lol (each,level +1) else : for each_tab range:
print ( \t ", End=" print (each)
The level=0 is the default argument. In and Words print_lol (list) equals to print_lol (list,0)
Finally, go to the Windows command line and run script: python setup.py sdist upload. and dont forget to install the problem again ( command:python setup.py sdist install )
To be Continue!
Learn python from ' Head first Python ' [2]: Sharing