import socket
x = input("""
Please enter a domain name that you wish to translate: """)
data = socket.gethostbyname_ex(x)
print("""
The IP Address of the Domain Name is: """ + repr(data))
x = input("""
Select enter to proceed back to Main Menu
""")
if x == '1':
    exec(compile(open('C:\\python\\main_menu.py').read(), 'C:\\python\\main_menu.py', 'exec'))
How to resolve DNS in Python?