Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

python
communitycreator
platform.system
method

What is the platform.system() method in Python?

Ravi

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

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.

Method signature

Let’s view the signature of this method.

system()

Parameters

This method has no parameters.

Return value

The return value is the operating system name.

Code

Let’s view the code of this method.

import platform
print("platform.system() = %s" % (platform.system()))
Try it out

Explanation

  • Line 1: We import the platform module.
  • Line 3: We use the system() method to retrieve the operating system’s name, on which the code is run.

RELATED TAGS

python
communitycreator
platform.system
method

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring