Answers for "how to pass arguments to python script"

0

how to pass arguments to python script from bash

>> python script.py var1 var2

import sys 

# contains the script name
sys.argv[0]

# contains the first variable (var1)
sys.argv[1] 

# contains the second variable (var2)
sys.argv[2]
Posted by: Guest on September-14-2021

Code answers related to "how to pass arguments to python script"

Python Answers by Framework

Browse Popular Code Answers by Language