使用从网站抓取 link 的循环仅打印 5 link 秒

print only 5 links using loop of crawled link from website

只需要打印 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
def brand_name_link(url):   
    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')
    k=0
    while k<len(link):
        print link[k]
        k+=1