A magical piece of code (Python 2.7) online screenshot demo

Source: Internet
Author: User

Apart first on the code:

#Coding=utf-8ImportUrllibImportReImport TimeGlobalx x= 1defgethtml (URL): page=urllib.urlopen (URL) HTML=Page.read ()returnHTMLdefgetimg (HTML):Globalx Reg= R'src= "(. +?\.jpg)" alt='Imgre=Re.compile (reg) Imglist=Re.findall (imgre,html) forImgurlinchImglist:urllib.urlretrieve (Imgurl,'%s.jpg'%x) x+ = 1returnimglistdefDelayrun (): I= 1 whileI <= 65: Time.sleep (2) URL="http://www.mzitu.com/80661/"+STR (i) HTML=gethtml (URL) getimg (HTML) I+ = 1if __name__=='__main__':    Globalx delayrun ()

First, python2.7 is installed on the computer. Then copy and paste the code into your own text editor and save the file as getmm.py

Then find the path of the file, Mac open a terminal, Win7 find the directory, enter CMD in the Address bar, enter the command line interface.

Input: Python getmm.py

Enter

Then open the folder where you are located. Enjoy it slowly.

A magical piece of code (Python 2.7) online screenshot demo

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.