This question already has an answer here:
Set-up
I scrape a ad names containing information I want to retrieve.
Example: name_ad = 'quarto duplo brilhante em santa apolonia'
Given the information in name_ad
I define a variable type
per ad.
Following is my code,
while True:
if 'cama de casal' or 'duplo' in name_ad:
type = 'double'
break
elif 'cama de solteiro' or 'único' or 'individual' in name_ad:
type = 'single'
break
else:
type = ''
break
which is based upon this answer.
Problem
I'm not breaking the loop correctly: for all ads I have that type = 'double'
, which is not true.
How do I correctly break my if/elif/else
loop?
Aucun commentaire:
Enregistrer un commentaire