Pick out ip-address
Jeff Epler
jepler at unpythonic.net
Mon Feb 16 08:04:39 EST 2004
On Mon, Feb 16, 2004 at 01:19:22PM +0100, Alexander Födisch wrote:
> 13 cmd=os.popen('LANG=""/sbin/ifconfig'+interface)
This line seems suspect. The resulting string passed to popen will be
along the lines of
LANG=""/sbin/ifconfigippp0
try running this at the prompt and you'll get nothing. (Well, actually,
the value of LANG will be set to a new value:
$ echo $LANG
/sbin/ifconfigippp0
When I write Python code that assembles strings, I'm much more likely to
use %-formatting than use + for concatenation:
cmd = os.popen('LANG="" /sbin/ifconfig %s' % (interface,))
etc
best of luck,
Jeff
More information about the Python-list
mailing list