Store IP address in a variable in python
Question: Can an IP address be stored in a variable in python? As,

    
    
    ip = "123.45.67.89"
    


Answer: The Python 3.x stdlib has an
[ipaddress](https://docs.python.org/3.4/library/ipaddress.html) module that
provides support for IP addresses.

**Unfortunately this is not available for Python 2.x** and so you may wish to
try [this backport](https://pypi.python.org/pypi/py2-ipaddress/), note that
the backport does not provide the full range of features but may be a good
place to start.

    
    
    # Python 3.4
    In [35]: import ipaddress
    
    In [36]: ip = ipaddress.ip_address('192.168.0.1')
    
    In [37]: print(ip)
    192.168.0.1
    
    In [38]: ip
    Out[38]: IPv4Address('192.168.0.1')
    

