我正在努力使用python的子进程.这是我的任务:
到目前为止我的尝试:
1.我被困在这里使用Popen.我明白,如果我使用
subprocess.call("put command here")这个作品.我想尝试使用类似的东西:
import subprocess
def run_command(command):
p = subprocess.Popen(command, shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
Run Code Online (Sandbox Code Playgroud)
我在哪里使用,run_command("insert command here")但这没有任何作用.
关于2.我认为答案应该类似于这里: 从Python运行shell命令并捕获输出,但由于我无法工作,我还没有尝试过.
我试图确定使用groovy返回嵌套键值的最佳方法.如果我有地图:
def map = [
OrganizationName: 'SampleTest',
Address: [
Street: '123 Sample St',
PostalCode: '00000',
]
]
Run Code Online (Sandbox Code Playgroud)
有没有办法归还所有的钥匙?OrganizationName,OrganizationURL,Address.Street,Address.PostalCode?如果我在地图中没有地图,我可以使用map.keySet()作为String [].我应该循环遍历每个键,看看它是否是另一个地图的实例?