[BangPypers] something similar to file command for python

Gora Mohanty gora at mimirtech.com
Wed Feb 29 04:23:14 CET 2012


On 28 February 2012 23:19, Amit Sethi <amit.pureenergy at gmail.com> wrote:
> Hi All , I am trying to read some file attachments being sent from
> blackberrys . However blackberry compresses the document into base64 . Now
> I am able to get the document by converting it back. However I wish to know
> the file extension of the original document. Now I know file command reads
> the document's header to find the file type . Is there some way of applying
> the same concept with python . I do not wish to use subprocess.

If you are on a Linux/Unix system you can use python-magic.

Regards,
Gora


More information about the BangPypers mailing list