2.2.2python的BeautifulSoup库
from bs4 import BeautifulSoup
import re
broken_html = '<ul class="country"><li>Area<li>Population</ul>'
soup = BeautifulSoup(broken_html,'html.parser')
fixed_html = soup.prettify()
print(fixed_html)
print("\n")
ul = soup.find('ul', attrs={'class':'country'})
print(ul)