In following code I am trying to append string 'timeout' as first element of list imput_cmd
. To do this, I am using insert
at 0th index of the list. but My print statement is always returning None
. Can someone please point what I am missing here ?
import subprocess
def run_command(command,timeout):
input_cmd = command.split()
print(command)
print(input_cmd)
imput_cmd_with_with_timeout = input_cmd.insert(0,'timeout')
print(imput_cmd_with_with_timeout)
run_command('sleep 60', 10)
I am using python 3.6