How to identify on which OS Python is running on?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Light Drops
--
Chapters
00:00 How To Identify On Which Os Python Is Running On?
00:13 Accepted Answer Score 1270
00:40 Answer 2 Score 222
00:56 Answer 3 Score 149
01:10 Answer 4 Score 141
03:05 Answer 5 Score 118
03:20 Thank you
--
Full question
https://stackoverflow.com/questions/1854...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #operatingsystem #crossplatform #platformagnostic
#avk47
    Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Light Drops
--
Chapters
00:00 How To Identify On Which Os Python Is Running On?
00:13 Accepted Answer Score 1270
00:40 Answer 2 Score 222
00:56 Answer 3 Score 149
01:10 Answer 4 Score 141
03:05 Answer 5 Score 118
03:20 Thank you
--
Full question
https://stackoverflow.com/questions/1854...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #operatingsystem #crossplatform #platformagnostic
#avk47
ACCEPTED ANSWER
Score 1298
>>> import os
>>> os.name
'posix'
>>> import platform
>>> platform.system()
'Linux'
>>> platform.release()
'2.6.22-15-generic'
The output of platform.system() is as follows:
- Linux: 
Linux - Mac: 
Darwin - Windows: 
Windows 
See: platform — Access to underlying platform’s identifying data
ANSWER 2
Score 222
Here are the system results for Windows Vista!
>>> import os
>>> os.name
'nt'
>>> import platform
>>> platform.system()
'Windows'
>>> platform.release()
'Vista'
And for Windows 10:
>>> import os
>>> os.name
'nt'
>>> import platform
>>> platform.system()
'Windows'
>>> platform.release()
'10'
ANSWER 3
Score 149
For the record, here are the results on Mac:
>>> import os
>>> os.name
'posix'
>>> import platform
>>> platform.system()
'Darwin'
>>> platform.release()
'8.11.1'
ANSWER 4
Score 118
Sample code to differentiate operating systems using Python:
import sys
if sys.platform.startswith("linux"):  # could be "linux", "linux2", "linux3", ...
    # linux
elif sys.platform == "darwin":
    # MAC OS X
elif os.name == "nt":
    # Windows, Cygwin, etc. (either 32-bit or 64-bit)