If i get the input as ls, how to pass the value in the call function and get output?
Example
$ Enter any command: ls
$ log.txt file.txt
If i get the input as ls, how to pass the value in the call function and get output?
Example
$ Enter any command: ls
$ log.txt file.txt
Simplifying Retrieving the output of subprocess.call() for the question:
from subprocess import Popen, PIPE
p = subprocess.Popen(['ls', '-l'], stdout = PIPE)
result = p.communicate()