Skip to content

Instantly share code, notes, and snippets.

@zhaofeng-shu33
Created May 15, 2020 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhaofeng-shu33/0cac8b004c68c58dfda5ff3d80753e2d to your computer and use it in GitHub Desktop.
Save zhaofeng-shu33/0cac8b004c68c58dfda5ff3d80753e2d to your computer and use it in GitHub Desktop.
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