我是python的新手,所以我尝试了以下Visual Studio和Windows 7
import csv
from bs4 import BeautifulSoup
import requests
contents = []
with open('websupplies.csv','r') as csvf: # Open file in read mode
urls = csv.reader(csvf)
for url in urls:
contents.append(url) # Add each url to list contents
for url in contents: # Parse through each url in the list.
page = requests.get(url).content
soup = BeautifulSoup(page, "html.parser")
price = soup.find('span', attrs={'itemprop':'price'})
availability = soup.find('div', attrs={'class':'product-availability'})
但是我得到了-未找到..'['a url']'
的连接适配器为什么?
csv的结构如下
https://www.websupplies.gr/epeksergastis-intel-core-i5-8400-9mb-2-80ghz-bx80684i58400
https://www.websupplies.gr/epeksergastis-intel-celeron-g3930-2mb-2-90ghz-bx80677g3930
https://www.websupplies.gr/epeksergastis-amd-a6-9500-bristol-ridge-dual-core-3-5ghz-socket-am4-65w-ad9500agabbox
他们最后没有分号