20

platform.machine()
Returns the machine type, e.g. 'i386'. An empty string is returned if the value cannot be determined.

What are the possible values for this field?

Jonathon Reinhart
  • 132,704
  • 33
  • 254
  • 328

2 Answers2

13

On platforms with os.uname(), this information comes directly from the result of that API call. That is to say, platform.machine() returns the same thing as the uname -m command.

Thus, the answer really depends on the kernel's implementation of the uname(2) system call. For that, see this question and answer:

Possible values for `uname -m` (utsname.machine)

Jonathon Reinhart
  • 132,704
  • 33
  • 254
  • 328
1

Possible values are listed there. For Unix and Linux based OSs, platform.machine() gives you the same answer than the command uname -m.

For Windows though it's a bit more complicated. uname doesn't exist on this platform and though Cygwin gives you the possibility to use uname -m it won't give you the same result as platform.machine() (respectively x86_64 and AMD64 on my Windows machine). That's because of a choice made with the platform module.