unicode - Detect if bytes object represent a PDF document in python -


i have list of bytes objects, can either :

  • a text (on know encoding)
  • a pdf document
  • a zip document

if can't decode bytes object, using like:

<bytes object>.decode(encoding) 

clearly not text. fine, can handle exception.

but how can detect if pdf or zip document ?


Comments

Popular posts from this blog

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -