lundi 15 novembre 2021

Multiple inputs and after if statement

I am trying to build a web scraper for jobs. Now, I am trying to add a multiple-input that will be checked by an if statement.

This is the code:

html_text = requests.get('https://www.timesjobs.com/candidate/job-search.html?searchType=personalizedSearch&from=submit&txtKeywords=python&txtLocation=').text

soup = BeautifulSoup(html_text , 'lxml')
print ('Write Your Skill That you are less familiar with')
**unfamiliar_skill = input (">").split(",")**
print (f'Filtering out {unfamiliar_skill}')
jobs = soup.find_all('li', class_ = "clearfix job-bx wht-shd-bx")
for job in jobs:
    published_date = job.find('span', class_ = "sim-posted").span.text
    if "few" in published_date:
        company_name = job.find('h3', class_ = "joblist-comp-name").text.replace(' ','')
        require_experiance = job.find('ul', class_ = "top-jd-dtl clearfix").li.text.replace("card_travel", '')
        skills_requirment = job.find('span', class_="srp-skills").text.replace(' ','')
        location_of_the_job = job.find('ul', class_ = "top-jd-dtl clearfix").span.text
        for_more_info = job.find('header', class_ = "clearfix").h2.a["href"]
        #for_more_info = job.header.h2.a["href"]
        **if unfamiliar_skill not in skills_requirment:**
            
            print(f"Company Name: {company_name.strip()}")  
            print(f"Require Experiance: {require_experiance.strip()}")
            print(f"Skill Requirment: {skills_requirment.strip()}")
            print(f"Location Of The Job: {location_of_the_job.strip()}")
            print(f"For More Info: {for_more_info}")
            print('') 

The error occurs on this code: if unfamiliar_skill not in skills_requirment: with this error message: 'in ' requires string as left operand, not list

I tried to add a strip() on the if statement and it also return an error, can someone help me with this?

Thanks

Aucun commentaire:

Enregistrer un commentaire