You are viewing a single comment's thread. Return to all comments →
import re for _ in range(int(input())): n=input() if re.match(r"^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9][0-9])$",n): print("IPv4") elif re.match(r"^([a-fA-F0-9]{1,4}:){7}[a-fA-F0-9]{1,4}$",n): print("IPv6") else: print("Neither")
Seems like cookies are disabled on this browser, please enable them to open this website
Find a Word
You are viewing a single comment's thread. Return to all comments →