python--只爬取网页中的文字或特定标签

from bs4 import BeautifulSoup
html_sample='''
\
  • 全部课程
    a biaoqian a biaoqian2 ''' soup=BeautifulSoup(html_sample,'html.parser') print(soup.text) a=soup.select('a') print(a) for i in a: print(i['href'])

 

你可能感兴趣的:(Python)