The platform
module in python provides functions that access information of the underlying platform (operating system).
The platform.system()
method is used to return the underlying operating system name. This method returns an empty string if it’s not able to determine the operating system name, for example, Linux
or Windows
.
Let’s view the signature of this method.
system()
This method has no parameters.
The return value is the operating system name.
Let’s view the code of this method.
import platformprint("platform.system() = %s" % (platform.system()))
platform
module.system()
method to retrieve the operating system’s name, on which the code is run.