import urllib.request, urllib.parse, urllib.error value = list(range(1, 10))[-1] if value != 9: print("Value %s is not 9" % value) else: print("Value is 9") try: assert 1 == 2 except AssertionError as e: print(e) print(urllib.request.urlopen('https://docs.python.org/2/library/exceptions.html').read())