You have to type this in terminal to get the ip address:
ip addr show
i m not getting it
with that comment
If you want to create and run a python code, no need of ip address…directly type =>“sudo nano file_name.py” to create one…and then save and =>“sudo python3 filename” to run it…
If you want to get the IP address of whichever interface is used to connect to the network without having to know its name, you can use this:
import socket def get_ip_address(): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("18.104.22.168", 80)) return s.getsockname()
You do not have to have a route to 22.214.171.124 to use this. All it is doing is opening a socket, but not sending any data.