Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
python get local ipv4 1

python get local ipv4

May 10, 2022 by Anurag batra
hostname = socket.gethostname()
local_ip = socket.gethostbyname(hostname)

Here is what the above code is Doing:
1. We’re creating a socket object.
2. We’re getting the hostname of the machine.
3. We’re getting the IP address of the machine.

Categories Python Examples
Post navigation
how to create a superuser in django
django update model
© MyEduKit - 2022 . All Rights Reserved.