Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用python子流程在macos字典中查找单词_Python_Macos_Subprocess - Fatal编程技术网

如何使用python子流程在macos字典中查找单词

如何使用python子流程在macos字典中查找单词,python,macos,subprocess,Python,Macos,Subprocess,我正在编写一个脚本来打开和搜索macOS字典应用程序 在终端,我可以做到这一点 打开dict://cheeseburger 应用程序将打开至奶酪汉堡入口 使用python的子流程模块,我可以做到: subprocess.Popen([“path\u to\u dictionary\u app”]) 然后应用程序打开 如何在子流程中包含搜索词?Popen的语法是subprocess.Popen(['command','arg1','arg2']) 就你而言: search='cheeseburge

我正在编写一个脚本来打开和搜索macOS字典应用程序

在终端,我可以做到这一点

打开dict://cheeseburger

应用程序将打开至奶酪汉堡入口

使用python的子流程模块,我可以做到:

subprocess.Popen([“path\u to\u dictionary\u app”])

然后应用程序打开


如何在子流程中包含搜索词?

Popen的语法是
subprocess.Popen(['command','arg1','arg2'])

就你而言:

search='cheeseburger'
args=['open','dict://'+搜索]
子进程Popen(args)