Created
November 23, 2021 22:40
-
-
Save owkx/891e8c3612434228692e3e5f9cf914c3 to your computer and use it in GitHub Desktop.
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
# author -> geeksceo | |
def ipv6_verificator(str): | |
if (':' not in str) or (':'*3 in str) or (len(str.split(':')) < 8 and str.count('::') != 1) : | |
return "That's not IPv6 address !" | |
for i in str.split(':'): | |
if i != '': | |
try: | |
int(i, 16) | |
except ValueError: | |
return "This string is not in hexadecimal format, \n That's not IPv6 address !" | |
break | |
return "It's IPv6 Address !" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Verified if an address is an IPv6 address.