title: How to differentiate between a ZIP file and Microsoft Office file in Python?
body: <p>I would like to differentiate between a ZIP file and a Microsoft Office file (xlsx, docx, pptx) given just the binary string. The first 4 bytes are all <code>0x504b0304</code>, but when I tried to use Python's <code>zipfile</code> library to read it into memory, it gave an error <code>zipfile.BadZipFile: File is not a zip file</code>. I've tried the same code with actual zip files and it works. Does this mean these files are actually Microsoft Office files? Or it could be they are truncated/corrupted? </p>
  
  <p>Is there anyway to identify ZIP file and Microsoft Office files?</p>