8

What are the possible return values from the following command?

import platform
print platform.system()

I've seen the SO question here, which is not the same question. And I've looked at the docs here but they only list: 'Linux', 'Windows', or 'Java'. What else is there? Do macs return "Mac"?

Community
  • 1
  • 1
Mr Purple
  • 2,325
  • 1
  • 18
  • 15

1 Answers1

6

platform.system() retrieves its information from the uname system call if available, or synthesizes a result if uname is not available. That means that there is no fixed set of possible returns—it gets it directly from the operating system, and the operating system can return whatever it wants there. For what it’s worth, Mac OS X will return Darwin. (If you’re interested, check the source.)

darthbith
  • 18,484
  • 9
  • 60
  • 76
icktoofay
  • 126,289
  • 21
  • 250
  • 231