代码拉取完成,页面将自动刷新
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)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。