Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
module ipaddress
#1
today, i was reading through the doc for module ipaddress. i have already used this module, but i am going through everything again, more slowly this time because i missed a lot the first time. so as i was reading i expected to see a function to convert IPv6Address types to a full format, fd00:1::5 -> fd00:0001:0000:0000:0000:0000:0000:0005. but i saw no such function. it would not be hard to write one, but i just never tried because i figured there already was one. so, did i miss this on an even slower read, or will i not be abused for writing one?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
There is exploded in ipaddress module.

>>> import ipaddress
>>> ip_6 = ipaddress.ip_address('fd00:1::5')
>>> ip_6.exploded
'fd00:0001:0000:0000:0000:0000:0000:0005' 
There is Python HOWTO-s >>> An introduction to the ipaddress module which "aims to provide a gentle introduction to the ipaddress module". There are lot of examples (including exploded) etc. It may be worth to have look at it.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#3
ah... that's how i missed it. it has a bad name. it should be "expanded" or "full". i need to read even slower so my brain doesn't just look for things, but looks at everything there.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  len() of ipaddress.ip_network() Skaperen 7 4,016 May-19-2019, 12:25 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020