generate functionSun, 13 Nov 2022

Check if internet is detected. If not, restart the computer.

def check_internet(): try: response = urllib2.urlopen('http://google.com',timeout=1) return True except urllib2.URLError as err: pass return False if check_internet() == False: os.system("shutdown /r /t 1")

Questions about programming?Chat with your personal AI assistant