Python reptile of XML

A request for a parameter in the form of xml

       for example.

       Now there is such a URL: https: //www.runff.com/html/live/s1484.html; you want to query the picture list, open the F12, we observed that request as follows:

       Here in the form of a request parameter xml, using python code write request to imitate

 

 We also can see the content of the return xml. This time we need to parse xml.

 

Two, xml parsing

   xml original (request return result irrespective above):

 1. transferred directly into process json

  Use xmltodict library

  Code:

 

Output:

 

  The output is an ordered dictionary, and values ​​can use the dictionary as "get".

Suppose there are a plurality of the same label, the conversion into a dictionary, the same values ​​will form a list of keywords.

   2. Direct parse xml

   Xml using the above

     Brief parsing code:

 

Output:

Guess you like

Origin blog.csdn.net/sinat_38682860/article/details/93522796