Passing List Values as Parameters
list = ['12345','23456']
I have a script "test.py",I need to pass the values in a given list above as parameters to this script with "pick" as option, can anyone provide input on how this can be done?
Final goal is to run the script like the following:
test.py pick 12345 23445
import subprocess lst = ['12345','23456'] cmd = ['test.py', 'pick'] cmd.extend(lst) subprocess.call(cmd)
Try this code. This will invoke the script test.py with args pick 12345 23456