from bs4 import BeautifulSoup import requestsa=requests.get('https://search.51job.com/list/030200,000000,0000,32,9,99,%25E5%2589%258D%25E7%25AB%25AF%25E5%25BC%2580%25E5%258F%2591,2,1.html?lang=c&stype=1&postchannel=0000&workyear=99&cotype=99°reefrom=99&jobterm=99&companysize=99&lonlat=0%2C0&radius=-1&ord_field=0&confirmdate=9&fromType=&dibiaoid=0&address=&line=&specialarea=00&from=&welfare=')a.encoding='gbk'soup = BeautifulSoup(a.text,'html.parser')#print(soup.find_all(name='div',attrs={"class":"el"}))# print(soup.find(id = "el"))for link in soup.find_all(name='p',attrs={"class":"t1"}): #print(link.find(attrs={"class":"t1"}).find('a')) print(link.find('a').get('href')) print(link.find('a').get('title'))
pip install beautifulsoup4
pip install requests