Extract part of a regex match

前端 未结 9 1976
北海茫月
北海茫月 2020-11-22 13:01

I want a regular expression to extract the title from a HTML page. Currently I have this:

title = re.search(\'.*\', html, re.IGNOR         


        
9条回答
  •  一向
    一向 (楼主)
    2020-11-22 14:01

    May I recommend you to Beautiful Soup. Soup is a very good lib to parse all of your html document.

    soup = BeatifulSoup(html_doc)
    titleName = soup.title.name
    

提交回复
热议问题