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
Post a Comment