[lug] Beginning Python // .dat file

J. Wayde Allen wallen at lug.boulder.co.us
Tue Jul 17 14:38:09 MDT 2001


On Mon, 16 Jul 2001, bill ehlert wrote:

>     but i'm still wondering
>     what is usually contained within a "real"
>       .dat  file and what to use to open it.

OK, file extensions are nothing more than part of the file
name.  Technically speaking a filename can be anything you want it to be,
and there is no "official" restriction that limits a file extension to a
specific format.  For instance you can have an html document called
webdoc.htm, webdoc.html, webdoc.doc, webdoc.dat, ..., and all of these
would be perfectly valid.  In other words a name is nothing more than just
simply a name, and if you have the file you can change it to whatever you
want.

Now it is true that some software packages like to pretend that extensions
have unique meaning, and we do often use filename extensions to indicate
something about file type.  As such there are some naming
conventions.  These can be looked up on the web.  Try looking at:

   http://www.matisse.net/files/formats.html
   http://www.wotsit.org/

However, just because something has one of these extensions doesn't
necessarily mean that you now know what the file type actually is.  You
can only be certain if you examine the files contents.  This is the basis
for the Unix convention of marking file contents with magic numbers.  Try
typing:

    man magic

to learn more about this.

Finally, the only convention I know of for the .dat extension is that this
usually indicates some sort of data file.  You might be able to infer
something about how the contents are written and the kind of data it
contains if you know something about the program that either reads or
created it.  My suggestion would be to open the file and see what it
contains.  Try either

   more yourfile.dat

or

   less yourfile.dat

If you can understand what it says then it is probably an ASCII data file
of some sort.  

- Wayde
  (wallen at lug.boulder.co.us)




More information about the LUG mailing list