On Fri, Jul 15, 2011 at 2:12 PM, Sibtey Mehdi <sibtey.me...@gmail.com> wrote: > Hi , > > I am writing a script in python to identify the type of a file.In most of > the cases I got the correct file type on the basis of file extension. > Is there any way to identify a PLSQL, TSQL or SQl file as these files may > have the same 'sql' extension.
Going by the extension is unreliable. If you are OK with running on a Linux (probably also other UNIX systems that support libmagic), you can use python-magic which provides bindings to libmagic: http://pypi.python.org/pypi/python-magic/ Regards, Gora _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers