Having established already a dynamic search for the offers based on companies generating a link where you use it to search it´s available job reviews done by the previous employees, I´m now faced with the question about coding the part that would let me after having assign job offers and job reviews to a list as well as description to iterate through them and print the correspondent.

It all seems easy to do until you notice that job offers list have a different size than job reviews so I´m on a standstill regarding the following situation.

I´m trying the following code which obviously gives me an error since cargo_revisto_list is longer in length than nome_emprego_list because once you have more reviews than job offers this tends to happen, as well as the opposite.

Lists would be per example, the following:

cargo_revisto_list = ["Business Leader","Sales Manager"]
nome_emprego_list = ["Business Leader","Sales Manager","Front-end Developer"]
opiniao_list = ["Excellent Job","Wonderful managing"]

It would be a question of luck to get them to be exactly the same size.

url = "https://www.indeed.pt/cmp/Novabase/reviews?fcountry=PT&floc=Lisboa"
comprimento_cargo_revisto = len(cargo_revisto_list) #19
comprimento_nome_emprego = len(nome_emprego_list) #10
descricoes_para_cargos_existentes = []

if comprimento_cargo_revisto > comprimento_nome_emprego:
    for i in range(len(cargo_revisto_list)):
        s = cargo_revisto_list[i]
        for z in range(len(nome_emprego_list)):
            a = nome_emprego_list[z]
            if(s == a): #A Stopping here needs new way of comparing strings
                c=opiniao_list[i]
                descricoes_para_cargos_existentes.append(c)
elif comprimento_nome_emprego > comprimento_cargo_revisto:
    for i in range(len(comprimento_nome_emprego)):
        s = nome_emprego_list[i]
        for z in range(len(cargo_revisto_list)):
            a = cargo_revisto_list[z]
            if(s == a) and a!=None:
                c = opiniao_list[z]
                descricoes_para_cargos_existentes.append(c)
else:
    for i in range(len(cargo_revisto_list)):
        s = cargo_revisto_list[i]
        for z in range(len(nome_emprego_list)):
            a = nome_emprego_list[z]
            if(s == a):
                c = (opiniao_list[i])
                descricoes_para_cargos_existentes.append(c)

After solving this issue I would need to get the exact review description about the job reviewed that corresponds to the job offer, so to solve this I would get the index of cargo_revisto_list and use that index to print opiniao_list (job description) that matches the job reviewed since it was added to the list at the same time and order by Beautiful Soup at the scrapping moment.

0 Answers