Pychallenge (4)-follow the chain, pychallenge-follow
Pychallenge 4th
<! -- Urllib may help. DON't try all nothings, since it will never
End. 400 times is more than enough. -->
The dot picture jumps out: and the next nothing is 44827, which looks like a nested webpage
#-*-Coding: UTF-8-*-import requestsimport reimport timeclass NothingException (Exception): def _ init _ (self, length, rtvalue): Exception. _ init _ (self) self. length = length self. rtvalue = rtvaluedef findnothing (start_noth): "": type start_noth: str: rtype nothing: str "nothing = start_noth url_prefix = 'HTTP: // required? Nothing = 'url = url_prefix + nothing try: for I in range (400): r = requests. get (url) print "now it's % d time for requesting for page: % s" % (I, url) time. sleep (1) if r. status_code = 200: nothing = re. findall ('and the next nothing is \ d +', r. content) # retrieve the target string in a fixed format if len (nothing )! = 1: raise NothingException (len (nothing), 1) # If there are more than one result, else: url = url_prefix + str (re. findall ('\ d +', nothing [0]) [0]) # normally retrieve nothing and continue to access else: print "get page % s failed" % url break failed t NothingException: print "now it's necessary for you to determine <nothing>. "print" hint is: % s "% r. content m_noth = raw_input ("please input <nothing>:") # manually determine nothing findnothing (m_noth) in non-normal words) return nothingif _ name _ = '_ main _': print findnothing ('20140901 ')
The final result is peak.html.