Here is yet another way to diplay a list of IP address associated with the current computer.
python -c "import socket; print '\n'.join(socket.gethostbyname_ex(socket.gethostname()))"
The socket.gethostname() call returns the host name of the computer. The socket.gethostbyname_ex() call returns a list of three items: The host name, the list of aliases for this host, and a list of IP addresses. Recall that Python’s array starts with index 0, the socket.gethostbyname_ex(…) expression refers to the list of IP addresses. Finally, the print statement prints out the IP addresses, one per line.