0
我想將網址添加到我收到的鏈接。我怎樣才能做到這一點? 我的源代碼是這樣python3 - 添加鏈接導入網址
</a></li><li><a href="/archive/2017-06-13">
Link title 2017-06-13
</a></li><li><a href="/archive/2017-06-12">
Link title 2017-06-12
</a></li><li><a href="/archive/2017-06-11">
而且我的Python 3碼
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import urllib.request
url = "https://myurl.com"
parseurl = "https://myurl.com/archivelist"
url_readd = urllib.request.urlopen(parseurl)
soup = BeautifulSoup(url_readd, 'html.parser')
project_href = [i['href'] for i in soup.find_all('a', href=True) if i['href'] != "#"]
for string in project_href:
print(append url(string))
你想在哪裏以及如何「添加」它們?你能舉一個例子嗎? – chrki
https://myurl.com/archive/2017-06-13 https://myurl.com/archive/2017-06-12 https://myurl.com/archive/2017-06-11 –