google hosts不解释

2015-06-28 0 955
google  hosts不解释
#!/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!")

遇见资源网 python google hosts不解释 http://www.ox520.com/15586.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务