How to pretty-print ctypes composite data types?

Discussion in 'Python' started by Grant Edwards, Oct 25, 2011.

  1. I'm using ctypes with a library that requires a handful of structure
    definitions. The actual definitions and usage aren't a problem. When
    it comes time to print out the values in a structure or array, there
    doesn't seem to be simple/general way to do that. Am I missing
    something?

    I presume one can recursively iterate through the fields in a
    structure and elements in an array, recursing on any composite types
    and printing the values when one finds a type, but I'm surprised
    that's not something that's already in the ctypes library somewhere --
    the authors certainly seem to have thought of everything else.

    --
    Grant Edwards grant.b.edwards Yow! I own seven-eighths of
    at all the artists in downtown
    gmail.com Burbank!
    Grant Edwards, Oct 25, 2011
    #1
    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. Henk Punt
    Replies:
    0
    Views:
    390
    Henk Punt
    Jul 23, 2004
  2. ramu
    Replies:
    2
    Views:
    314
    rlblaster
    Feb 20, 2006
  3. Replies:
    0
    Views:
    491
  4. Robert Dailey

    'pretty print' for built in types

    Robert Dailey, Dec 9, 2008, in forum: Python
    Replies:
    3
    Views:
    230
    Chris Rebert
    Dec 9, 2008
  5. Sam
    Replies:
    2
    Views:
    939
    Diez B. Roggisch
    Oct 17, 2009
Loading...

Share This Page