Where is the method to find out the OS in the program?

Asked 1 years ago, Updated 1 years ago, 92 views

Where is the module that identifies the operating system (Windows, UNIX, etc.) within the Python script?

python os-detection

2022-09-22 22:23

1 Answers

There's a way to write. There is a slight difference between each module, but I don't think you can use anything if you ask.

If you ran the code below in OS X

import os
print os.name


import platform
print platform.system()

import sys
print sys.platform

Output:

posix
Darwin
darwin


2022-09-22 22:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.