title: How do I get my local ip address from a python script on linux?
body: <p>I am trying to run a python server on a Raspberry Pi, and I need the local IP address of it to connect. I realize I can just type ifconfig and get my IP address, but I would really like to be able to get it from the python script. I have tried <code>socket.gethostbyname(socket.getfqdn())</code>, but that seems to only work on Windows. When I run it on my raspberry pi, it seems to always return <code>127.0.1.1</code>. Does anyone know a command that will get the local IP address on linux?</p>