“como obter o nome do host do ip python” Respostas de código

Python Get IP do HostName

## importing socket module
import socket
## getting the hostname by socket.gethostname() method
hostname = socket.gethostname()
## getting the IP address using socket.gethostbyname() method
ip_address = socket.gethostbyname(hostname)
## printing the hostname and ip_address
print(f"Hostname: {hostname}")
print(f"IP Address: {ip_address}")
Friendly Falcon

como obter o nome do host do ip python

#This is how I got the hostname from the ip
import socket

# get input from user
input01 = input("\nType IP: ").upper() 

#gets information
output = socket.gethostbyaddr(str(input01))

#processes the information to only get the hostname
outputProceesed = str(output).split("'")[1::2]

#prints hostname
print(f"Their Hostname is {outputProceesed[0]}\n")
Fragile Fish

Respostas semelhantes a “como obter o nome do host do ip python”

Perguntas semelhantes a “como obter o nome do host do ip python”

Mais respostas relacionadas para “como obter o nome do host do ip python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código