Reputation: 13
I am actually trying to give an arrayList (System.Collections.ArrayList) in a powershell script to a python script like this :
Powershell script
$exampleArray= New-Object System.Collections.ArrayList
$tabChemins.Add("test1") | Out-Null
$tabChemins.Add("test2") | Out-Null
$tabChemins.Add("test3") | Out-Null
python.exe .\exampleScriptPython.py $exampleArray
import sys
print(sys.argv[1])
print(sys.argv[2])
print(sys.argv[3])
test1 test2 test3
['test1','test2','test3']
Upvotes: 1
Views: 810
Reputation: 6206
Seems like you can simply use the array sys.argv[1:]
for whatever it is that you want to do.
And if you want to pass it to a function as separate arguments, then I believe that *sys.argv[1:]
would do the job.
Upvotes: 1