im
port requests
from bs4 im
port BeautifulSoup
im
port bs4
def get
HTMLText(url):
try:
r = requests.get(url, timeout=30)
r.raise_for_status()
r.encoding = r.apparent_encoding
return r.text
except:
return ""
def fillUnivList(ulist,
html):
soup = BeautifulSoup(
html, "
html.parser")
for a in soup.find(
'tbody
').children:
if isinstance(a, bs4.element.Tag):
tds = a(
'td
')
ulist.append([tds[0].string, tds[1].string, tds[2].string, tds[3].string])
def printUnivList(ulist, num):
print("{:^10} {:^6} {:^6} {:^16}".format("排名","学校名称","地区","总分"))
for i in range(num):
u=ulist[i]
本文地址:http://sjzytwl.xhstdz.com/quote/70584.html
物流园资讯网 http://sjzytwl.xhstdz.com/ , 查看更多