Python: have urllib skip failed connection -
using nokia n900 , have urllib.urlopen statement want skipped if server offline. (if fails connect > proceed next line of code ) .
how should / done in python?
according urllib documentation, raise ioerror if connection can't made.
try: urllib.urlopen(url) except ioerror: # exception handling goes here if want pass else: dosomethinguseful() edit: unutbu pointed out, urllib2 more flexible. python documentation has tutorial on how use it.
Comments
Post a Comment