How can I execute a command who has input
I want to execute a python script that has 3 inputs.
so I want to execute a script in a shell with one line and pass the values of the inputs to it.
I've seen one solution for this, but it only works if I only have one input. the command looks like this:
$ echo "params input" | python myscript.py
the problem is the command doesn't work if i have more than 1 input
any suggestion please? thank
+3
source to share
3 answers
You can use the argparse module that python provides: argparse tutorial
Then you should write the following:
python myscript.py arg1 arg2 arg3
0
source to share