wiki.py
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
# 获取维基百科主页所有词条及链接
#请求url并把结果用utf-8编码
resp = urlopen("https://en.wikipedia.org/wiki/Main_Page").read().decode("utf-8")
#使用beautifulsoup去解析
soup=BeautifulSoup(resp,'html.parser')
#获取所有以/wiki/开头的a标签的Href属性
listUrls = soup.findAll("a",href=re.compile("^/wiki/"))
#输出所有的词条对应的名称和url
for url in</