Some error are reported, when format
string that is a shell command.
The python code:
str = "jps | grep {0} | grep -v {1} | awk '{print $1}' | xargs kill -9".format(1,2)
The error information:
Traceback (most recent call last):
File "<stdin>", line 1, in <module> KeyError: 'print'
How to fix it?