Truncate beginning of a file

Discussion in 'Python' started by s0suk3@gmail.com, May 5, 2008.

  1. Guest

    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). 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.)
     
    , May 5, 2008
    #1
    1. Advertisements

  2. On Sun, 04 May 2008 22:06:42 -0700, s0suk3 wrote:

    > 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). 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.)


    No.

    Ciao,
    Marc 'BlackJack' Rintsch
     
    Marc 'BlackJack' Rintsch, May 5, 2008
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    659
    Jack Klein
    Jun 5, 2004
  2. Natevw

    truncate end of file

    Natevw, Nov 3, 2004, in forum: C++
    Replies:
    1
    Views:
    3,347
    Victor Bazarov
    Nov 3, 2004
  3. Amit Kulkarni

    HOW-TO Truncate first line in a file to zero length?

    Amit Kulkarni, Jun 22, 2004, in forum: C Programming
    Replies:
    4
    Views:
    3,827
    dbtid
    Jun 23, 2004
  4. Hongyu
    Replies:
    9
    Views:
    1,260
    James Kanze
    Aug 8, 2008
  5. Chuck Remes
    Replies:
    7
    Views:
    501
    Gary Wright
    Feb 9, 2010
  6. Jesse B.
    Replies:
    9
    Views:
    481
    Jesse B.
    Mar 27, 2010
  7. Leslie Viljoen

    File#truncate fills file with zeros

    Leslie Viljoen, Nov 16, 2010, in forum: Ruby
    Replies:
    1
    Views:
    249
    Leslie Viljoen
    Nov 16, 2010
  8. BG
    Replies:
    2
    Views:
    245
Loading...