使用urllib获取一个静态页面内所有a标签的href标签
import re, urllib.request, urllib.parse, urllib.error
page = input('Enter - ')
fhand = urllib.request.urlopen(page)
for line in fhand:
str = line.decode().strip()
hrefs = re.findall('href="([^\"]*)"', str)
for href in hrefs:
print(href)