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()

Want to kickstart your project?Use the new AI Studio to create your code