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"'])
精彩评论