Skip to content

How to find IP address using Python and cmd Windows 10

  • by
find IP address python cmd windows 10

In this article, you will learn how to find IP address using Python and cmd Windows 10 An IP address stands for “INTERNET PROTOCOL”.

It is a numerical label that is assigned to each device that is connected to a computer network that uses the Internet Protocol for communication.

Contents

Find IP Address using Python and CMD Windows 10

IP Address using Python

Every device has its own IP address which is connected to the internet. Individual devices communicate through the web with their IP address.

It is less important to ask about the IP address but if you want to know about the IP address in window 10. We use the following method:

  • Click on the Start button and select the setting option.
  • Then press on the internet icon.

Make sure your network connection is perfect and it appears on the left side pane. If your network connection is wired or worst, then your Ip address is shown in the IPv4 field.

If your network connection is strong, select that network and press Advanced Options. Then you should find your IP address in the IPv4 field.

An alternative way of finding IP address Python and cmd Windows 10

You can use the socket library to get your laptop IP


addresss = socket.gethostbyname("your host name")

Like this:

import socket

your_h_name = socket.gethostname()

address = socket.gethostbyname(your_h_name)

print("Your PC Name is:" + your_h_name)

print("Your PC IP Address is:" + address)

Run the following command.


pip install socket

IP address  using CMD Windows 10

Right press the windows icon in the bottom left of your screen.

  • Select the command prompt from the list.
  • A black and white window will appear where you will type ipconfig all and click on the enter button.
  • Commamdipconfig and the switch of all have a space between them.

When a technician wants to check the IP address of your Ethernet card, the information follows after the title of Ethernet Local Area  Adapter gigabit connection. Your IP address will appear as the IPv4 address.

The information of the wireless card will follow the title of Wireless Lan adapter connection. Any description which comprises the word ‘Virtual’   is not the information that is needed for creating an internet connection for you.

Read more: How to fix IndexError: too many indices for array?

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *