Mar-16-2022, 09:37 AM
Hi guys.
On my lan i have the following pc (ip -> pc name):
I’d like an output like this:
On my lan i have the following pc (ip -> pc name):
Quote:192.168.0.1 → pc01My code is:
192.168.0.114 → pc02
192.168.0.118 → pc03
192.168.0.136 → pc04
ip_list = [‘192.168.0.114’, ‘192.168.0.118’, ‘192.168.0.1’, ‘192.168.0.136’] for ip in ip_list: print(ip) for ip in ip_list: print(socket.gethostbyaddr(ip))Output of first loop for is:
Quote:192.168.0.114and the output of second loop for is::
192.168.0.118
192.168.0.1
192.168.0.136
Error:print(socket.gethostbyaddr(ip))
socket.herror: [Errno 1] Unknown host
Libraries are imported correctly.I’d like an output like this:
Quote:pc02What am i wrong??
pc03
pc01
pc04