This is my code
import socket
ip=56.90.89.78
ip2=str(IP)
M=socket.gethostbyaddr(ip2)
print (m)
If you just want to "convert" a literal IP address into a string, then like juanpa mentioned, it's just a matter of quoting in single or double quotes:
ip = "56.90.89.78"
If on the other hand, you want to resolve the IP address to a name, then you could indeed use the socket.gethostbyaddr function:
import socket
ip = "56.90.89.78"
name = socket.gethostbyaddr(ip)
print(name)
ip=56.90.89.78is a syntax error in Python. Or are you asking about that? In Python, string literals are written using single or double quotes, so this could just beip = "56.90.89.78"orip = '56.90.89.78'