Skip to content

Instantly share code, notes, and snippets.

@p208p2002
Created January 4, 2019 13:29
Show Gist options
  • Select an option

  • Save p208p2002/025a7adb7b07bb048a197099dcc89cb3 to your computer and use it in GitHub Desktop.

Select an option

Save p208p2002/025a7adb7b07bb048a197099dcc89cb3 to your computer and use it in GitHub Desktop.
def getBsObj(url):
try:
html=urlopen(url)
except:
print('open url fail')
return 1
try:
bsObj=BeautifulSoup(html.read(),'html.parser')
except:
print('html parser fail')
return 1
return bsObj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment