Created
April 11, 2016 19:22
-
-
Save chrismaddalena/3477828c7f37b93f1377c34351f57085 to your computer and use it in GitHub Desktop.
Take two lists and combines them into one with alternating lines from each, like a zipper
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import os | |
fileOne = sys.argv[1] | |
fileTwo = sys.argv[2] | |
with open(fileOne, 'r') as one, open(fileTwo, 'r') as two, open('combined.txt', 'w') as output: | |
for line in one: | |
output.write(line.rstrip() + '\n') | |
output.write(two.readline().strip() + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment