What if beautifulsoups call returns null?
pagelinks = myhtml.findAll('a')
for link in pagelinks:
do_stuff()
开发者_StackOverflow
If pagelinks is null, will this error out?
How can I make pagelinks a collection of 0 items in case it is null?
findAll
returns an empty list []
when nothing matches
for link in pagelinks:
do_stuff() # never executed when findAll returns []
精彩评论