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 :: plotly title font size 
Python :: bubble sort python 
Python :: python dict exclude keys 
Python :: how to take password using pyautogui 
Python :: python get words between two words 
Python :: no such table: django_session 
Python :: making a python code without python 
Python :: par o inpar python 
Python :: how to leave some parameters in python and let the value be anything 
Python :: init image with zeros python 
Python :: anaconda create new environment 
Python :: fig title python 
Python :: Python USD to Euro Converter 
Python :: replace space with _ in pandas 
Python :: annaul sum resample pandas 
Python :: place a widget in tkinter 
Python :: masking function pyspark 
Python :: Python program to find Cumulative sum of a list 
Python :: df invert sort index 
Python :: skewness python 
Python :: matlab find in python 
Python :: check if response is 200 python 
Python :: tag for deleting from a list in python 
Python :: python selenium button is not clickable at point 
Python :: how to re run code in python 
Python :: serializers.py include all fields 
Python :: streamlit button to load a file 
Python :: pyspark concat columns 
Python :: delay time python 
Python :: exit python script 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =