On 9/18/2009 10:05 AM ad...@gg-lab.net said...
Hi,
i'm putting file in a DB as BLOB entries. To serve them, i need to
take Content-Type headers.
So, i'm looking for a function that returnes the filetype, given a data str.
I've found many other topics like this in python mail-archive, but any
of them contains the solution.
Can you help me, please?
I'd take a look at python-magic at
http://hupp.org/adam/hg/python-magic/file/d3cd83e5a773 where the example
shows that you can do:
# For MIME types
>>> mime = magic.Magic(mime=True)
>>> mime.from_file("testdata/test.pdf")
'application/pdf'
HTH,
Emile
Thankyou!
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor