pop line from file
Sybren Stuvel
sybrenUSE at YOURthirdtower.com.imagination
Wed Feb 15 08:05:49 EST 2006
Sinan Nalkaya enlightened us with:
> i searched and google long long time but couldnt find any result, i
> want pop the first line from file, i dont want to read all file
> contents because file is being updated from another proccess.
So basically, what you want is some sort of on-disk FIFO queue, right?
Unless your filesystem supports this, there is no way to do that
programmatically.
Removing the first line of a file without having to rewrite the entire
file, requires the pointer to the beginning of the data of the file to
be altered. Since this pointer usually consists of a block number, it
is impossible to point to the new start, unless all lines in the file
are exactly one block in length. This probably isn't the case.
If you're working on a UNIX platform, you could use FIFO pipes, see
'mkfifo'.
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
More information about the Python-list
mailing list