What is the purpose of "struct" and "array" modules

Discussion in 'Python' started by Igor Katson, May 28, 2009.

  1. Igor Katson

    Igor Katson Guest

    I pretty much understand what they do, but what's the case of using
    these modules by example? Is it something like pickle, to store the data
    efficiently in files?
     
    Igor Katson, May 28, 2009
    #1
    1. Advertising

  2. Igor Katson

    Matimus Guest

    On May 28, 11:17 am, Igor Katson <> wrote:
    > I pretty much understand what they do, but what's the case of using
    > these modules by example? Is it something like pickle, to store the data
    > efficiently in files?


    For one it provides a mechanism for reading and writing arbitrary file
    formats. For example, suppose you wanted to parse a PNG image using
    python code. It is likely that that format is described in its
    specification using C data structures (I've never looked at PNG format
    specifically). In python you can't just read out some data and copy it
    directly into a data structure. You could use the struct module
    though.

    It really has nothing to do with serializing python data structures.
    It is (mostly) about data formats and objects defined in other
    languages.

    Matt
     
    Matimus, May 28, 2009
    #2
    1. Advertising

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. Chris Fogelklou
    Replies:
    36
    Views:
    1,423
    Chris Fogelklou
    Apr 20, 2004
  2. Replies:
    12
    Views:
    755
    Pierre Asselin
    May 9, 2007
  3. Replies:
    3
    Views:
    1,127
  4. Replies:
    2
    Views:
    301
  5. Tuan  Bui
    Replies:
    14
    Views:
    506
    it_says_BALLS_on_your forehead
    Jul 29, 2005
Loading...

Share This Page