Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to get hostname from ip python

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

# get input from user
input01 = input("
Type 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]}
")
Comment

PREVIOUS NEXT
Code Example
Python :: python print file 
Python :: how to speak the text with python 
Python :: hbox(children=(floatprogress(value= 
Python :: how to sort a list by the second element in tuple python 
Python :: how to append to text file with new line by line in python 
Python :: check corently installed epython version 
Python :: python runtime 
Python :: initialize pandas dataframe with column names 
Python :: update jupyter notebook 
Python :: count nan pandas 
Python :: python get current number of threads 
Python :: matplotlib title 
Python :: pd.to_datetime python 
Python :: make length string in pandas 
Python :: replit clear 
Python :: string with comma to int python 
Python :: np array to df 
Python :: dollar 
Python :: when did guido van rossum create python 
Python :: les librairies python a maitriser pour faire du machine learning 
Python :: pandas drop rows with null in specific column 
Python :: random color python matplotlib 
Python :: panda dataframe to list 
Python :: superscript print python 
Python :: matplotlib legend 
Python :: python json dump utf8 
Python :: brownie normalize to wei 
Python :: python get int from string 
Python :: draw bounding box on image python cv2 
Python :: pyspark create empty dataframe 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =