Python – How to Pass Arguments into a Python Script

python

I know how to pass arguments into a shell script. These arguments are declared in AWS datapipeline and passed through. This is what a shell script would look like:

firstarg=$1
secondarg=$2

How do I do this in Python? Is it the exact same?

Best Answer

This worked for me:

import sys
firstarg=sys.argv[1]
secondarg=sys.argv[2]
thirdarg=sys.argv[3]
Related Question