ip address and host name

Used socket to get the ip address and host name. We kept the code inside try & except for exception handling.
import socket
        my_host = socket.gethostname() 
        my_ip = socket.gethostbyname(my_host) 
        print("Hostname :  ",my_host) 
        print("IP : ",my_ip) 
        print("Unable to get Hostname and IP address")
The output will change based on your hosting server.

PHP Script to display IP address.
All Built in Functions in Python bin() complex()
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net


    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2023 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer