How to find out your IP address in Python

/ Published in: Python
Save to your folder(s)

Copy this code and paste it in your HTML
  1. import socket
  2. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  3. s.connect(('', 0))
  4. s.getsockname()[0]


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.