Re: parsing text from "ethtool" command

2011-11-02 Thread Jean-Michel Pichavant
extraspecialbitter wrote: 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 issu

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.

Re: parsing text from "ethtool" command

2011-11-01 Thread Ian Kelly
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. This would also work and be a bit more discriminat

Re: parsing text from "ethtool" command

2011-11-01 Thread Miki Tebeka
In my box, there are some spaces (tabs?) before "Speed". IMO re.search("Speed", line) will be a more robust. -- http://mail.python.org/mailman/listinfo/python-list

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