开发者

Calling External Command On Python Without Quotes

Following the advice given in; Calling an external command in Python

I have been experimenting using the call() function to call an external command, however the command I need to call is being called correctly but it does not like the parameters being passed to it. This is be开发者_如何学JAVAcause the Call function is passing the parameters with ' 's around them.

E.g

test = call(['/opt/program/something/lookup', 'search "bob"'])

The search part must be passed to the command lookup without any characters surrounding it, I have tried a few different permutations of the call function with varying levels of quotes, spaces, lack of commas etc. The second statement - bob, must be within quotes.

Is there a clean way to do this?

Example of return value of test atm;

Error: 'search "bob"' is not a valid command.


This should work - if not then please update the question with specific error text:

test = call(['/opt/program/something/lookup', 'search', '"bob"'])
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜