[EMAIL PROTECTED] writes:

> file.truncate(X) will truncate the file to at most X bytes (i.e.
> leave the first X bytes of the file and throw away the rest).

Yes, by (IIRC) asking the filesystem to do this in a simple operation.
Most (all?) filesystems support this operation either directly or with
little effort.

> Is there a way to throw away, say, the first X bytes of the file,
> and leave the rest? (Without opening the same file for reading,
> reading and processing, overwriting the file with the new processed
> data, etc.)

I don't know of any filesystem that supports this operation without
reading the file data. The built-in 'file' type doesn't support it.

-- 
 \       "It's easy to play any musical instrument: all you have to do |
  `\       is touch the right key at the right time and the instrument |
_o__)                     will play itself."  -- Johann Sebastian Bach |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to