I would like to run bash commands in python3. However, different commands have different types of output, and need to be called differently (as far as I know).
For example:
cat /etc/passwd | grep user
and
cat /etc/passwd
subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8')
alsamixer or nano or vi:
subprocess.call(command.split(" "))
What would be a better way to make it so that, regardless of the command, it gets handled correctly? (Show nano, or get the output of grep)?