Fredrik Lundh wrote: > Neal Becker wrote: > >> Any thoughts on howto find the interface associated with the default >> route (this is on linux)? > > are you sure you sent this to the right newsgroup ? > > is this what you want ? > > >>> import os > >>> for line in os.popen("/sbin/route"): > ... line = line.split() > ... if line[0] == "default": > ... print line[-1] > ... > eth0 >
Well, I was hoping for something more 'elegant' - meaning relying on library calls rather than calling programs. Obviously, /sbin/route has some library calls to obtain this info, and maybe python has a wrapper for it. Yes, this is the right group - I want a python solution. -- http://mail.python.org/mailman/listinfo/python-list