xxxxxxxxxx
import socket
ip_address = '127.0.0.1'
hostname = 'localhost'
# Resolve the hostname to an IP address
resolved_ip = socket.gethostbyname(hostname)
# Check if the resolved IP address is equal to 127.0.0.1
if resolved_ip == ip_address:
print(f"{hostname} and {ip_address} refer to the same local machine.")
else:
print(f"{hostname} and {ip_address} do not refer to the same local machine.")