I have a probably simple problem for you that are more experienced in this than I am. Ive been learning web scraping in Selenium for a couple of weeks and in one of my codes everything runs smooth except the if-else statement. No matter if the condition under if is true or not, it always goes to else.
In my code I have a for loop that checks if there is an element who's text is Katastarska čestica and if there is it puts some attribute in variable called katCestica. Under else statement I give that variable a value of a blank element so that in the spreadsheet the cell for that category would be blank. No matter if the element exists or not on the page I'm scrapping, else statement will always run and the cell will be blank.
for k in range(1, duzina):
if 'Katastarska čestica' in kategorije[k].text:
katCestica = atributi[k]
k = k+1
else:
katCestica = prazno
I'm sorry if there is something i missed to mention, I hope someone can help me with this.
Thank you all in advance.
Aucun commentaire:
Enregistrer un commentaire