Skip to content Skip to sidebar Skip to footer

How Can You Run A Python Script As A Batch Job After Passing An Argument Using Argparse?

I was wondering whether it is possible to run a python script as a bash job after using argparse? I tried doing this by first passing an argument in the python script file using ar

Solution 1:

You need to pass along the arguments to the python script. If you know the exact number of your arguments you can write smth like:

#!/bin/bash# passing two arguments
python message_script.py "$1""$2"

Or all of them:

#!/bin/bash
python message_script.py "$@"

Post a Comment for "How Can You Run A Python Script As A Batch Job After Passing An Argument Using Argparse?"