1 Star 2 Fork 2

刘彬彬/小知识_自动化任务脚本_DhanushNehru

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
update_readmes.py 899 Bytes
一键复制 编辑 原始数据 按行查看 历史
import os
def update_links(readme_path):
try:
with open(readme_path, 'r') as file:
content = file.read()
# Example update: replace 'old-link' with 'new-link'
updated_content = content.replace('old-link', 'new-link')
with open(readme_path, 'w') as file:
file.write(updated_content)
print(f"Updated {readme_path}")
except Exception as e:
print(f"Failed to update {readme_path}: {e}")
def find_and_update_readmes(root_dir):
for root, dirs, files in os.walk(root_dir):
for file in files:
if file.lower() == 'readme.md':
file_path = os.path.join(root, file)
update_links(file_path)
if __name__ == "__main__":
root_directory = '.' # Update this to your repo's root directory if necessary
find_and_update_readmes(root_directory)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/liu_binbin/some_python_scripts.git
git@gitee.com:liu_binbin/some_python_scripts.git
liu_binbin
some_python_scripts
小知识_自动化任务脚本_DhanushNehru
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385