I'm trying to web scraping.
using BeautifulSoup, i'm parsing several objects and confronted with a problem.
The problem is, i can't predict where the error occur using "find" method.
it looks like
a = soup.find(something).find(something)
b = soup.find(something)
...
f = soup.find(something).find(something)
among a,b,c,d,e,f, error can happen anywhere and their code should not be revised.
the variable 'b' is not matter because it would be None, which is ok.
but variable 'a' or 'f' is problem, because it would end the script.
i know there is "try - exception" grammar but that's not what i want. of course it can be written like this:
try :
a = soup.find(something).find(something)
except Exception:
a = None
...
try :
f = soup.find(something).find(something)
except Exception:
f = None
looks ridiculous, doesnt it?
how can i handle it gracefully?