12345678910111213141516171819202122232425262728293031323334 |
- import os
- f = open("imgmap.txt",'r')
- s = f.read().split('\n')
- f.close()
- imgmap = []
- for i in s:
- if i != '':
- imgmap += [i.split(' ')]
- for root, dirs, files in os.walk(os.path.join("..", "docs")):
- for file in files:
- if file.endswith(".md"):
- fn = os.path.join(root, file)
- f = open(fn,'r')
- s = f.read()
- f.close()
- for i in imgmap:
- s=s.replace(i[0],"img/"+i[1])
- f = open(fn.replace("docs","localdocs"),'w')
- f.write(s)
- f.close()
|