2017-10-06 58 views
0
def analyze_html(url, root_url): 
    savepath = download_file(url) 
    if savepath is None: 
     return # here 
    if savepath in proc_files: 
     return # here 
    proc_files[savepath] = True 
    print("analyze_html", url) 
    html = open(savepath, "r", encoding="utf-8").read() 
    links = enum_links(html, url) 
    for link_url in links: 
     if link_url.find(root_url) != 0: 
      if not re.search(r".css$", link_url): 
       continue 
     if re.search(r".(html|htm)$", link_url): 
      analyze_html(link_url, root_url) 
      continue 
     download_file(link_url) 

请参阅我用双星号包裹的if语句。 我觉得在返回后必须有一些东西要归还。 这是什么意思?“返回”后可以没有任何东西吗?

回答

相关问题