How can I store multiple strings to variables automatically, in Python?
cmdFindListCards=Popen("ifconfig -a | grep Link | cut -d ' ' -f1", shell=True, stdout=PIPE, universal_newlines=True)
listCards=cmdFindListCards.communicate()[0].rstrip()
I don't know if we've got the [code] tag enabled here.
The output of the first line is:
docker0
enp1s0
lo
vboxnet0
wlan1
How can I make Python automatically create one variable for each line, in which the variable is assigned to the value of that string (the interface name), like this?:
card1=docker0 (first line value)
card2=enp2s0 (second line value)
card3=lo (third line value)