Created
December 4, 2010 12:58
-
-
Save dfilimon/728161 to your computer and use it in GitHub Desktop.
Getting all IP addresses of a particular machine in Python. Unfortunately it doesn't work properly in Linux without a properly configured /etc/hosts file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.ip = [ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment