使用urllib的urljoin()拼接两个地址
urlljoin的第一个参数是基础母站的url,第二个是需要拼接成绝对路径的url。
from urllib import parse
url1 = "http://www.youtube.com/user/khanacademy"
url2 = "123"
new_url = parse.urljoin(url1,url2)
print(new_url)
使用urllib的urljoin()拼接两个地址
urlljoin的第一个参数是基础母站的url,第二个是需要拼接成绝对路径的url。
from urllib import parse
url1 = "http://www.youtube.com/user/khanacademy"
url2 = "123"
new_url = parse.urljoin(url1,url2)
print(new_url)
转载于:https://www.cnblogs.com/wqzn/p/11510087.html