import sys


# window下hosts路徑
HOSTS_PATH = r'C:/WINDOWS/system32/drivers/etc/HOSTS'

# mac/linux系統(tǒng)hosts路徑為/private/etc/hosts
# HOSTS_PATH = r'/private/etc/h" />

国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

18143453325 在線咨詢 在線咨詢
18143453325 在線咨詢
所在位置: 首頁 > 營銷資訊 > 建站知識 > python添加域名host

python添加域名host

時間:2023-02-02 01:52:01 | 來源:建站知識

時間:2023-02-02 01:52:01 來源:建站知識

# -*- coding: utf-8 -*-
import sys


# window下hosts路徑
HOSTS_PATH = r'C:/WINDOWS/system32/drivers/etc/HOSTS'

# mac/linux系統(tǒng)hosts路徑為/private/etc/hosts
# HOSTS_PATH = r'/private/etc/hosts'


def set_env_hosts():
hosts_detail = D:/xxx/resources/test_hosts (把域名配置放在txt文件加下的)
content = open(hosts_detail, 'r')
lines = content.readlines()
content.close()

output = open(HOSTS_PATH, 'w')
for line in lines:
output.write(line)
http://logger.info("環(huán)境hosts已配置")
output.close()


def clear_hosts():
with open(HOSTS_PATH, 'w') as hosts_files:
hosts_files.truncate(0)


if __name__ == "__main__":
set_env_hosts()
# clear_hosts()

關(guān)鍵詞:

74
73
25
news

版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點擊下載Chrome瀏覽器
關(guān)閉