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

Answers


Use subprocess

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


Need Your Help

Get the bounds of the plane visible at a specific z coordinate

c# math opengl opentk frustum

Using OpenTK, I've created a window (800x600) with a vertical FOV of 90°.

WiseScript: Get user executing a running process

windows installer wise

I know that the currently logged on windows user can be detected via WiseScript using:

Retrieving 1D arrays from NetCDF char array variables in HDF5 files using Java

java string char hdf5 netcdf

Using the Java API for NetCDF, I have an HDF5 file with an array of type CHAR, which according to the documentation is similar to strings containing only ASCII characters: "The char type contains

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.