python3.5 climb to the glory of the King's website All heroes of the skin

Source: Internet
Author: User

Recently followed the teacher climbed the king of Glory to stroll the network hero skin;

Tools: Vscode

Version: python3.5

JSON file required:

Get the following steps:


Copy this link to the browser, direct download, garbled without the tube is the browser did not parse well;

When you use it, you can change the address of the JSON file to your own.

The code is as follows:

# Imports module Import Requests # PIP install requests import JSON # Read JSON file with open (' X://users//zhaomeng//downloads//herolist . Json ', ' r ', encoding= ' utf-8 ') as FF: # Read jsonfile = json.load (FF) # Extract JSON file for M in range (len (jsonfile)): # Number name ename = jsonfile[m][' ename '] # Chinese name cname = jsonfile[m][' cname '] # after cutting is a dictionary list form skinname = jsonf 
    ile[m][' Skin_name '].split (' | ') # count each hero's skin how many Skinnumber = Len (skinname) print (skinnumber) # This loop is to download the image Construction image URL for Bigskin in range (1,sk innumber+1): # 1-skinnumber # specify picture url urlpicture = ' http://game.gtimg.cn/images/yxzj/img201606/skin/hero-i nfo/' +str (ename) + '/' +str (ename) + '-bigskin-' +str (bigskin) + '. jpg ' # Get picture information picture is binary content is to get two level information Pictur E = Requests.get (urlpicture). Content # Save information Save picture with open (' x:\\users\\zhaomeng\\desktop\\1234\\ ' +cname+sk The results of inname[bigskin-1]+ '. jpg ', ' WB ' as f:f.write (picture) are as follows:



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.