google hosts不解释,googlehosts解释,#!/usr/bin/p


#!/usr/bin/python3#coding=utf-8import osimport sysimport urllib.requestreq_hosts=urllib.request.urlopen("https://raw.githubusercontent.com/vokins/simpleu/master/hosts")content=req_hosts.read().decode("utf8")try:    f_hosts=open("/etc/hosts","w")    f_hosts.write(content)except PermissionError:    args = [sys.executable] + sys.argv    #os.execlp('su', 'su', '-c', ' '.join(args))    os.execlp('sudo', 'sudo', *args)f_hosts.close()print("Write hosts success!")

评论关闭