generate functionSun, 13 Nov 2022

Restart the computer if no internet connection is detected.

import urllib2 def restartIfNoInternet(): try: response=urllib2.urlopen('http://google.com',timeout=5) return True except urllib2.URLError as err: pass return False restartIfNoInternet()

Questions about programming?Chat with your personal AI assistant