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(('google.com', 0))
  4. s.getsockname()[0]

URL: http://commandline.org.uk/python/how-to-find-out-ip-address-in-python/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.