![]() 'Windows' # for Linux it prints 'Linux', Mac it prints `'Darwin' How this works ( source): Internally it checks if python has OS-specific modules called posix or nt.Ĭon: no differentiation between Linux or OSX. ![]() ![]() 'nt' # for Linux and Mac it prints 'posix' See here for various OS-specific values.Ĭon: OS version dependent, so best not to use directly. How this works ( source): Internally it calls OS APIs to get name of the OS as defined by OS. 'win32' # could be 'linux', 'linux2, 'darwin', 'freebsd8' etc There are 3 ways to get OS in Python, each with its own pro and cons: ![]() ![]() It returns Windows, Linux or Darwin (for OSX). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |