google hosts不解释

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/usr/bin/python3
#coding=utf-8
import os
import sys
import urllib.request

req_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!")