Although Python is often used as a cross-platform language, it is occasionally necessary to know what sort of system a program is running on. Build tools need that information, but an application might also know that some of the libraries or external commands it uses have different interfaces on different operating systems. For example, a tool to manage the network configuration of an operating system can define a portable representation of network interfaces, aliases, IP addresses, etc. But when the time comes to edit the configuration files, it must know more about the host so it can use the correct operating system configuration commands and files. The platform module includes the tools for learning about the interpreter, operating system, and hardware platform where a program is running.
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.