On Mon, Oct 31, 2011 at 16:16, extraspecialbitter
<pauldavidm...@gmail.com> wrote:

>    if line[10:20] == "Link encap":
>       interface=line[:9]
>    cmd = 'ethtool %interface'
>    print cmd
>    gp = os.popen(cmd)

because you're saying that cmd is 'ethtool %interface' as you pointed
out later on...

how about:

cmd = 'ethtool %s' % interface

note the spaces there... that tells it to convert the contents of
interface to a string and insert them into the string you're assigning
to cmd...

assuming interface is things like eth0, you shoud now see "ethtool
eth0" when the print statement runs.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to