python - is it possible to enter user-chosen input and output files
Question: I'm a newbie in python, so please bear with me.

I don't know how to describe,so I'll just show an example.

    
    
    python CODE.py -i1 input1.txt -i2 input2.txt -o output.txt
    

Is such thing possible with python? I've looked up for a while but haven't
find an answer.

Thank you!


Answer: As [thefourtheye](http://stackoverflow.com/users/1903116/thefourtheye) said
you can used argparse module. But if you want simple solution, just pass 2
inputs and output file paths as arguments to your executable and use
`sys.argv` to get them in your program in order. The `sys.argv[0]` is your
application name, `sys.argv[1]` is first input file path, `sys.argv[2]` is
second input file path and `sys.argv[3]` is output file path.

    
    
    import sys
    input1 = sys.argv[1]
    input2 = sys.argv[2]
    output = sys.argv[3]
    

now you can call like below:

    
    
    python my_app.py /path/to/input1.txt /path/to/input2.txt /path/to/output.txt
    

