Login  | Home

Catalin George Festila: Python 3.7.4 : Example with subprocess - part 001.

Go back


Article:

(published: Oct. 7, 2019, 1:16 p.m.)

This is a simple example with the python 3 subprocess package. The source code is simple to understand. The execute_proceess_with_communicate let run the ls command with the sudo user permissions: import os import sys import string import subprocess import codecs inp = '' cmd = 'ls' password = '' def execute_proceess_with_communicate(inp): """Return a list of hops from traceroute command.""