Answers for "cmd to get ip address python"

1

cmd to get ip address python

pip install netifaces

################

from netifaces import interfaces, ifaddresses, AF_INET
for ifaceName in interfaces():
    addresses = [i['addr'] for i in ifaddresses(ifaceName).setdefault(AF_INET, [{'addr':'No IP addr'}] )]
    print '%s: %s' % (ifaceName, ', '.join(addresses))
Posted by: Guest on June-01-2021

Python Answers by Framework

Browse Popular Code Answers by Language