Re: parsing text from "ethtool" command

2011-11-02 Thread extraspecialbitter
On Nov 1, 7:35 pm, Ian Kelly wrote: > On Tue, Nov 1, 2011 at 5:19 PM, Miki Tebeka wrote: > > In my box, there are some spaces (tabs?) before "Speed". IMO > > re.search("Speed", line) will be a more robust. > > Or simply: > > if "Speed" in line: > > There is no need for a regular expression here.

parsing text from "ethtool" command

2011-11-01 Thread extraspecialbitter
I'm still trying to write that seemingly simple Python script to print out network interfaces (as found in the "ifconfig -a" command) and their speed ("ethtool "). The idea is to loop for each interface and print out its speed. I'm looping correctly, but have some issues parsing the output for al

How do I pass a variable to os.popen?

2011-10-31 Thread extraspecialbitter
I'm trying to write a simple Python script to print out network interfaces (as found in the "ifconfig -a" command) and their speed ("ethtool "). The idea is to loop for each interface and print out its speed. os.popen seems to be the right solution for the ifconfig command, but it doesn't seem to