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

Asked 2 years ago, Updated 2 years ago, 101 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.