1 dict1 = {getlisturl:getlistdata,getskuurl:getskudata, approveurl:approvedata, Approvedlisturl: Approvedlistdata, Searchpresellurl:searchpreselldata, deletepresellurl:deletepreselldata}
And then
Import Collections
info = dict (name='cold', blog='linuxzen.com') for in Info.items (): print':', Value
Also learned, Mom egg, call function, stupid cry boingonium hindering:
defkolapprove (URL1, value): Kolrequest= Requests.post (url=url1,json=value,cookies=userlogin.cookies)Print(Kolrequest.url) Pprint (Kolrequest.json ())ifKolrequest.status_code = = 200: Print(Kolrequest.status_code,kolrequest.reason,'\ n') Else: Print(Kolrequest.read ())defMain ():Print('Let\ ' s try it'+'\ n' ) forUR, VAinchDict1.items (): Kolapprove (Ur,va)
# Use Main to start calling main ()
Later found, with dict, not sequential request interface, then changed to list:
#done, the original to be a pair of inside only can use. Items ()defkolapprove (URL1, value): Kolrequest= Requests.post (url=url1,json=value,cookies=userlogin.cookies)Print(Kolrequest.url) Pprint (Kolrequest.json ())ifKolrequest.status_code = = 200: Print(Kolrequest.status_code,kolrequest.reason,'\ n') Else: Print(Kolrequest.read ())defMain ():Print('Let\ ' s try it'+'\ n' ) forNumberinchList1: forUR, VAinchNumber.items (): Kolapprove (Ur,va)
Then, I heard a ordereddict, ordered dictionary, first loaded Utils library, and then:
from Import ordereddict " " "' == ordereddict (numbers) for in ordered_ Dict.items (): print (k,v)
Can not be written directly in the form of a dictionary such as Numbers={a:b,c:d},
should be written numbers = ((A, B), (C,D))
Then use ordered_numbers = ordereddict (numbers) to generate an ordered dictionary,
Then it can be output sequentially, you can request the interface in order, La La la?
Python3 's Dict