请高手帮忙看看,小弟我怎么杀掉已获取的pid

请高手帮忙看看,我如何杀掉已获取的pid
'''获取服务进程ID'''
stdin, stdout, stderr = mySSHclient.exec_command("ps -ef|grep 'BMP' | awk '{print $2}'")
pid = [i[:-1] for i in stdout.readlines()]
print pid[0]
stdin, stdout, stderr = mySSHclient.exec_command("'kill -9 %s',pid[0]")
print stdout.read()

------解决方案--------------------
多了一层引号。

stdin, stdout, stderr = mySSHclient.exec_command('kill -9 %s' % pid[0])