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

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -