add change_cdn script

This commit is contained in:
numbbbbb
2014-06-03 17:26:42 +08:00
parent 7128c39950
commit 33bff42d88

17
change_cdn.py Normal file
View File

@ -0,0 +1,17 @@
#!/usr/bin/python
import os
def iter(path):
for root, dirs, files in os.walk(path):
for fn in files:
if fn.endswith(".html"):
with open(root + '/' + fn, 'r') as f:
content = f.read()
content = content.replace('<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.1.3/ace.js"></script>', '<script src="http://cdn.bootcss.com/ace/1.1.3/ace.js"></script>').replace('<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.1.3/mode-javascript.js"></script>', '<script src="http://cdn.bootcss.com/ace/1.1.3/mode-javascript.js"></script>')
with open(root + '/' + fn, 'w') as f:
f.write(content)
iter(os.getcwd())