I researched and tried to do this in several ways. I execute the command:
ethers = []
ethers1 = os.system("ifconfig|grep eth|cut -c 1-4")
ethers2 = os.system("ifconfig|grep wla|cut -c 1-4")
ethers3 = os.system("ifconfig|grep ath|cut -c 1-4")
I wanted the output of this command to be part of my empty list ethers = []
I tried with append
but it did not work if you have another solution other than os.system.
EDIT 1
Good people, I was able to solve it like this:
import subprocess, os
p = os.popen('ifconfig | grep eth | cut -c 1-4')
s = p.readline()
p.close()
print("Interface(s) Disponíveis")
print(s)
interface_internet = input(" \n Digite a Interface de Internet: ")
if interface_internet in s:
After the "if" I will do my conditions ... I hope to help someone with such hugs information!