parameters: (url, retry=5, max_num=30)
docstring: Collects a comma-separated set of hosts (host:port) and optionally
      randomize the returned list.
docstring_summary: Collects a comma-separated set of hosts (host:port) and optionally
      randomize the returned list.
docstring_tokens: Collects a comma - separated set of hosts ( host : port ) and optionally randomize the returned list .
function: def get_wencai_stockcode(url, retry=5, max_num=30):
      """
      Collects a comma-separated set of hosts (host:port) and optionally
      randomize the returned list.
      """
      while retry > 0:
          try:
              req = urllib2.Request(url=url)
              req_data = urllib2.urlopen(req, timeout=30)
              res = req_data.read()
  
              dom = etree.HTML(res.decode("utf-8", 'ignore'))
              #code_xpath = "//*[@id=\"tableWrap\"]/div[2]/div/div[2]//td[3]/div" #还得自己改，让我还得学lxml和F12
              code_xpath = "//*[@id=\"tableWrap\"]/div[2]/div/div[2]//td[@width=\"66\"]/div"
              code_divs = dom.xpath(code_xpath)
  
              codes = [code_div.text for code_div in code_divs]
              return codes[:max_num]
  
          except:
              traceback.print_exc()
              retry -= 1
function_tokens: def get_wencai_stockcode ( url , retry = 5 , max_num = 30 ) : while retry > 0 : try : req = urllib2 . Request ( url = url ) req_data = urllib2 . urlopen ( req , timeout = 30 ) res = req_data . read ( ) dom = etree . HTML ( res . decode ( "utf-8" , 'ignore' ) ) #code_xpath = "//*[@id=\"tableWrap\"]/div[2]/div/div[2]//td[3]/div" #还得自己改，让我还得学lxml和F12 code_xpath = "//*[@id=\"tableWrap\"]/div[2]/div/div[2]//td[@width=\"66\"]/div" code_divs = dom . xpath ( code_xpath ) codes = [ code_div . text for code_div in code_divs ] return codes [ : max_num ] except : traceback . print_exc ( ) retry -= 1