Learn python from ' Head first Python ' [2]: Sharing

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.