Good evening/morning,
I have been passing a lot of commands to the terminal in a python program and was wondering if there was a way of passing a command and immediately saving the printed information without having to first save it to a file and then read that file in?
For example, this is what I have been doing:
os.system("lspci -tv > results")
if Addresses[i-1] in open('results').read():
Is there a way to just store the results from lspci -tv to a variable in my program so my program isn't dependent on another file and cluttering my computer with files every time I need to use this method?
Thanks in advance.