Python: Valid an IP address
Python Basic: Exercise-139 with Solution
Write a Python program to valid an IP address.
import socket addr = '127.0.0.2561' try: socket.inet_aton(addr) print("Valid IP") except socket.error: print("Invalid IP")
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?