Created
May 15, 2020 10:28
-
-
Save zhaofeng-shu33/0cac8b004c68c58dfda5ff3d80753e2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import os | |
def replace_frame_str(str): | |
r_ex = re.compile(r'\\FRAME.*?}}', flags=re.DOTALL) | |
return re.sub(r_ex, '%FRAME', str) | |
def replace_frame_file(filename): | |
with open(filename) as f: | |
st = f.read() | |
st_new = replace_frame_str(st) | |
with open(filename, 'w') as f: | |
f.write(st_new) | |
if __name__ == '__main__': | |
for i in os.listdir('./'): | |
if i.find('.tex') > 0: | |
replace_frame_file(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment