I am scraping a Website, where I am trying to get the
Location
,Graduation
,Job type
andSalary
seperately so that I can use it later.
This is the Code:
r2 = requests.get(link, headers = headers)
soup2 = BeautifulSoup(r2.content, 'lxml')
locationPTag = soup2.find_all('p', class_= 'card-meta')
for k in locationPTag:
getLocation = k.text.strip()
print(getLocation)
here the
link
is: https://www.karmasandhan.com/public-service-commission-west-bengal-wbpsc-assistant-engineer-jobs-advt-no-21-2020/40261
Output received is:
West Bengal, Multiple Cities
Engineering Diploma/ Degree
Regular
15600 — 42000
This is a Single Item. How can I separate all of them to separate Variables so as to use them individually?
Try this:
r2 = requests.get(link, headers = headers)
soup2 = BeautifulSoup(r2.content, 'lxml')
locationPTag = soup2.find_all('p', class_= 'card-meta')
Location, Graduation, Job_type, Salary = [k.text.strip() for k in locationPTag]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.