import os
def modify_file(file_path, replacements):
with open(file_path, 'r') as file:
content = file.read()
for old_value, new_value in replacements.items():
content = content.replace(old_value, new_value)
with open(file_path, 'w') as file:
file.write(content)
# 定义需要替换的内容和对应的新值
replacements = {
'old_value1': 'new_value1',
'old_value2': 'new_value2',
'old_value3': 'new_value3'
}
# 指定文件路径
file_path = 'path/to/your/file.txt'
# 调用函数修改文件
modify_file(file_path, replacements)Powered by ddoss.cn 12.0
©2015 - 2026 ddoss
渝公网安备50011302222260号 |
渝ICP备2024035333号|小程序:渝ICP备2024035333号-2X |
博客简介 |
工程建设规划 |
【实验平台安全承诺书】
主机监控系统: 安全防火墙已开启检查cc攻击-下载文件完成后等待10s 恢复访问,检查连接数低于峰值恢复访问
您的IP:216.73.216.108,2026-03-03 10:04:16,Processed in 0.01227 second(s).