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 :: how to get number after decimal point 
Python :: python how to automatically restart flask sever 
Python :: list comprehesion python 
Python :: how to clear the list in python 
Python :: python selenium send keys enter send 
Python :: python disable logging on unittest 
Python :: How to store the input from the text box in python 
Python :: django meta attributes 
Python :: discordpy owner only command 
Python :: pillow python text example 
Python :: how to check any script is running in background linux using python 
Python :: python regular expression 
Python :: python crop string 
Python :: python cut string to length 
Python :: python turtle fill 
Python :: password guessing game python 
Python :: to str python 
Python :: What is the use of f in python? 
Python :: seaborn barplot remove error bars 
Python :: django queryset to list 
Python :: python variable is not none 
Python :: str replace pandas 
Python :: python binary search 
Python :: remove brases from array py 
Python :: django error handling < form 
Python :: pyjwt 
Python :: temp python web server 
Python :: python create file in current directory 
Python :: how to separate url from text in python 
Python :: python list files in folder with wildcard 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =