用户登录
用户注册

分享至

google hosts不解释

  • 作者: 段子渝北小哥
  • 来源: 51数据库
  • 2022-08-12
#!/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!")
软件
前端设计
程序设计
Java相关