Created
January 27, 2015 22:33
-
-
Save NotTheEconomist/2fc47c411aa5a71e0748 to your computer and use it in GitHub Desktop.
This file contains 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
with open('new.txt') as f, open('orig.txt') as f2: | |
def zipper(f, f2): | |
for line in zip(f, f2): | |
yield line | |
next(f2) # skip every other f2 line | |
with open('out.txt', 'w') as out: | |
out.writelines(zipper(f,f2)) | |
# then replace orig.txt with out.txt | |
# maybe os.remove('orig.txt'); os.rename('out.txt', 'orig.txt') ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment