I have written a simple program using psutil to get interface IP address and interface name
def get_int_ip():
ifaces = psutil.net_if_addrs()
for k, v in ifaces.items():
ip = v[0].address
print("IP : " + ip + " name = " + k)
is this correct program?
will it work for Ubuntu & FreeBSD?
ip = v[0].address . -> Using 0th index to get ip address. Is this right?
Thanks,
Nilesh