Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get IP address python

import socket    
hostname = socket.gethostname()    
IPAddr = socket.gethostbyname(hostname)    
print("Your Computer Name is:" + hostname)    
print("Your Computer IP Address is:" + IPAddr) 
#How to get the IP address of a client using socket
Comment

get ip address py

import requests

# Prints public IPv4 address:
print(requests.get('https://utilities.tk/network/info').json()['ip'])

# Prints more info like location, hostname etc
print(requests.get('https://utilities.tk/network/info').json())
Comment

get ip address python

import socket
socket.gethostbyname(socket.gethostname())
Comment

get ip python

import re

f = open('C:/Users/Admin/Downloads/iplogs.txt', 'r') #Text file with many ip address
o = f.read()
ip1 = re.findall( r"d{1,3}.d{1,3}.d{1,3}.d{1,3}", o )
hosts = ip1
for host in hosts:
                    print(host)
Comment

PREVIOUS NEXT
Code Example
Python :: print(hello world) 
Python :: legend font size python matplotlib 
Python :: seconds to datetime.time 
Python :: how to sum all the numbers in a list in python 
Python :: How to join two dataframes by 2 columns so they have only the common rows? 
Python :: flask cookies 
Python :: how to do a mac vendor lookup in python 
Python :: turn off warning when import python 
Python :: python - find specific name in a df 
Python :: python 3d array 
Python :: Determine the sum of al digits of n 
Python :: python add to list 
Python :: virtualenv python2 
Python :: create pandas dataframe from dictionary 
Python :: what is module in python 
Python :: python tkinter projects 
Python :: pyspark dataframe to parquet 
Python :: matplotlib subplots 
Python :: how to open cmd at specific size using python 
Python :: pandas legend placement 
Python :: pd.read_csv 
Python :: python fill zeros left 
Python :: how to convert each string to a category or int in python dataframe 
Python :: pandas data frame to list 
Python :: pandas swapaxes example 
Python :: Creating a donut plot python 
Python :: declare pandas dataframe with values 
Python :: python cache 
Python :: python pandas get labels 
Python :: remove in list python 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =