Last active
August 29, 2015 14:20
-
-
Save martin-ueding/732de53d573d790f2b32 to your computer and use it in GitHub Desktop.
Script for http://askubuntu.com/q/616765/12824
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/python3 | |
# -*- coding: utf-8 -*- | |
# Copyright © 2015 Martin Ueding <dev@martin-ueding.de> | |
# Licensed under The MIT License | |
import argparse | |
def main(): | |
options = _parse_args() | |
with open(options.first) as f: | |
lines1 = [s.strip() for s in f.readlines()] | |
with open(options.second) as f: | |
lines2 = f.readlines() | |
for first, second in zip(lines1, lines2): | |
with open(first + '.txt', 'w') as f: | |
f.write(second) | |
def _parse_args(): | |
''' | |
Parses the command line arguments. | |
:return: Namespace with arguments. | |
:rtype: Namespace | |
''' | |
parser = argparse.ArgumentParser(description='') | |
parser.add_argument('first') | |
parser.add_argument('second') | |
options = parser.parse_args() | |
return options | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment