1 2 3 4 5 6 7 8 9 10 11 12
import glob for f in glob.glob('*.rst'): print f fd = open(f, 'r') fd_content = fd.read() fd.close() fd = open(f, 'w') new_content = fd_content.replace('\\_', '_') fd.write(new_content) fd.close()