前端设置根目录
<head>
<base href="http://www.w3school.com.cn/i/" />
<base target="_blank" />
</head>
<body>
<img src="eg_smile.gif" />
<a href="http://www.w3school.com.cn">W3School</a>
</body>
scrapy
可利用urllib 和scrapy中的response.urljoin(url) 去拼接
from urllib import parse
url = response.urljoin(u)
url_path = parse.urlparse(url).path
url_basename = os.path.basename(url)
网友评论