Find System IP Using Python

⤷Find IP Address Using Python

  1. Open Terminal
  2. Goto pyton console
  3. Enter Following Codes.
Source Code:

Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> import socket

>>> socket.gethostbyname(socket.gethostname())

'127.0.1.1'

* For find you ip u need socket package import that
socket.gethostbyname(hostname)
Translate a host name to IPv4 address format. The IPv4 address is returned as a string, such as '127.0.1.1'. If the host name is an IPv4 address itself it is returned unchanged. gethostbyname() does not support IPv6 name resolution.




Comments

Popular posts from this blog

Uninstall ODOO module using terminal

How to Delete Menuitem-Odoo