Created
December 8, 2018 20:24
-
-
Save zackn9ne/9f07b6a720142816ef6d184f22680b50 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
detect = '#+BEGIN_SRC emacs-lisp :exports code' | |
detectend = '#+END_SRC' | |
infile = 'c:/Users/netkam/OneDrive - Peralta Community College District/org/1812.org' | |
outfile = open('C:/Users/netkam/AppData/Roaming/.emacs', 'w') | |
with open(infile) as input_data: | |
# Skips text before the beginning of the interesting block: | |
for line in input_data: | |
if line.strip() == detect: # Or whatever test is needed | |
break | |
# Reads text until the end of the block: | |
for line in input_data: # This keeps reading the file | |
if line.strip() == detectend: | |
break | |
# print line # Line is extracted (o | |
outfile.write(line) | |
# yield line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment