You are viewing a single comment's thread. Return to all comments →
Real world solution (avoid doing such things manually):
from ipaddress import ip_address for _ in range(int(input())): try: addr = ip_address(input()) print("IPv4" if addr.version == 4 else "IPv6") except ValueError: print("Neither")
Seems like cookies are disabled on this browser, please enable them to open this website
IP Address Validation
You are viewing a single comment's thread. Return to all comments →
Real world solution (avoid doing such things manually):