Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80750

Re: netaddr value back to IP

From Michael Ströder <michael@stroeder.com>
Newsgroups comp.lang.python
Subject Re: netaddr value back to IP
Date 2014-11-14 10:03 +0100
Organization A noiseless patient Spider
Message-ID <m44gh0$er$1@dont-email.me> (permalink)
References <mailman.15782.1415896539.18130.python-list@python.org>

Show all headers | View raw


Noah wrote:
> I am trying to get a value back to IP using the netaddr python module.
> How do I get the value 'ip' back to IP format?  how is it done?
> 
> ---- snip ----
> 
>     print IPNetwork(v4_peer_ip).value
>     ip = IPNetwork(v4_peer_ip).value + 1
>     print ip
> 
> --- snip ---

>>> ip=netaddr.IPAddress('192.168.71.20')
>>> ip+=1
>>> str(ip)
'192.168.71.21'

Ciao, Michael.

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

netaddr value back to IP Noah <noah-list@enabled.com> - 2014-11-13 16:30 +0000
  Re: netaddr value back to IP Michael Ströder <michael@stroeder.com> - 2014-11-14 10:03 +0100

csiph-web