發表文章

目前顯示的是 2月, 2022的文章

Obtain IP address (Windows / Linux sys.) from Python – plus simple practice

Table of Contents Windows System Linux A Simple Demo Programs operating on different systems make no unique IP address. This can cause problems whenever we specify an exact IP address in services while executing the service programs on other machines/internet. This simple instruction introduces netifaces in Python to flexibly locate IP address depending on Internet and systems of the device/machine.   Windows System Open command line tool (whatever you’d like to run python) and go into Python environment. And then   import netifaces   Run ni_interface = netifaces.interfaces() This will list several interface identifiers of the machine (list of identifiers). One can see different configurations according to machines. The identifier is unique within the subnet and can identify interface of particular node. Well, just a brief note about interface and not knowing details will not prevent us from going for the next few steps. print(ni_interface) From t...