title: Python: get windows OS version and architecture
body: <p>First of all, I don't think this question is a duplicate of<br>
  <a href="https://stackoverflow.com/questions/2208828/detect-64bit-os-windows-in-python">Detect 64bit OS (windows) in Python</a><br>
  because imho it has not been thoroughly answered.</p>
  
  <p>The only approaching answer is:  </p>
  
  <blockquote>
    <p>Use <code>sys.getwindowsversion()</code> or the existence of PROGRAMFILES(X86)  (<code>if 'PROGRAMFILES(X86)' in os.environ</code>)</p>
  </blockquote>
  
  <p>But:  </p>
  
  <ul>
  <li>Does the windows environment variable <code>PROGRAMFILES(X86)</code> reliable? I fear that anyone can create it, even if it's not present on the system.</li>
  <li>How to use <code>sys.getwindowsversion()</code> in order to get the architecture?</li>
  </ul>
  
  <p>Regarding <code>sys.getwindowsversion()</code>:<br>
  The link <a href="http://docs.python.org/library/sys.html#sys.getwindowsversion" rel="noreferrer">http://docs.python.org/library/sys.html#sys.getwindowsversion</a><br>
  leads us to <a href="http://msdn.microsoft.com/en-us/library/ms724451%28VS.85%29.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms724451%28VS.85%29.aspx</a><br>
  but I don't see anything related to the architecture (32bit/64bit).<br>
  Moreover, the platform element in the returned tuple seems to be independent of the architecture.</p>
  
  <p>One last note: I'm looking for a solution using both python 2.5 and a windows version starting at Windows XP</p>
  
  <p>Thanks!</p>
  
  <p>Edit:<br>
  The relevant info is available here<br>
  <a href="http://msdn.microsoft.com/en-us/library/ms724340%28v=VS.85%29.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms724340%28v=VS.85%29.aspx</a><br>
  but how can I get this with python?</p>
  
  <p>Edit2:
  On a 64bit windows, with a 32bit python interpreter:  </p>
  
  <ul>
  <li>os.environ["PROCESSOR_ARCHITECTURE"] returns
  
  <ul>
  <li>'x86'</li>
  </ul></li>
  <li>platform.architecture() returns
  
  <ul>
  <li>('32bit', 'WindowsPE')</li>
  </ul></li>
  </ul>