Files
lt_quick_script/proxy_line/write_file.py
T
2025-11-14 23:38:58 +08:00

15 lines
596 B
Python

import json
def writ_json_file(root_folder_path,sart_index_num, file_total_count,target_ip,start_listen_port) :
for i,v in enumerate(range(sart_index_num, sart_index_num + file_total_count)):
# 定义一个json
port = str(start_listen_port + i)
target = target_ip + ":" + port
json_config = {
"server": target,
"port": ":"+ port,
}
print(json_config)
# 写对应文件
with open(f'{root_folder_path}/{v}.json', 'w', encoding='utf-8') as json_file:
json.dump(json_config, json_file, indent=4)