Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Added Hostname file #48

Merged
merged 1 commit into from
Jul 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions projects/Find Out Hostname and IP address/Hostname_IPaddress.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# importing socket library
import socket

def get_hostname_IP():
hostname = input("Please enter website address(URL):")
try:
print (f'Hostname: {hostname}')
print (f'IP: {socket.gethostbyname(hostname)}')
except socket.gaierror as error:
print (f'Invalid Hostname, error raised is {error}')

get_hostname_IP()