0
鏈接需要從URL中提到的特定網站只打印10個品牌名字,請幫我
from re import findall
import csv
import re
import urllib
from bs4 import BeautifulSoup
def brand_name_link("https://priceraja.com/mobile/brands/"):
htmlfile= urllib.urlopen(url)
#htmltext = htmlfile.read()
data=[]
link=[]
soup = BeautifulSoup(htmlfile, 'html.parser')
name_box = soup.find('ul', attrs={'class': 'top-brands'})
for tag in name_box.find_all('img'):
tag.replaceWith('')
link=tag
link=name_box.find_all('a')
print link