安装txdpy
urljoin(),第一个参数可以传入地址栏链接,也可以传入response对象
import requests
from txdpy import urljoin
url='http://zsb.tiangong.edu.cn/196/list1.htm'
# href=a.xpath('./@href')[0]
href='/2022/0909/c196a79194/page.htm'
href=urljoin(url,href)
print(href)
res=requests.get(url)
href=urljoin(res,href)
print(href)