Pretty Print Python Data Structures to HTML

Discussion in 'Python' started by Sam, Oct 17, 2009.

  1. Sam

    Sam Guest

    I'm looking for something like the pprint module but that can take a
    Python data structure and turn it into HTML (or better xHTML).

    It would read through the data structure but instead of formatting it
    using spaces it would format it using either dd/dt or ordered/
    unordered lists or even as a html table.

    Have I explained this well enough that you can understand what I
    mean? Is such a library available anywhere?

    Thanks
     
    Sam, Oct 17, 2009
    #1
    1. Advertising

  2. Sam

    Mensanator Guest

    On Oct 17, 2:25�am, Sam <> wrote:
    > I'm looking for something like the pprint module but that can take a
    > Python data structure and turn it into HTML (or better xHTML).
    >
    > It would read through the data structure but instead of formatting it
    > using spaces it would format it using either dd/dt or ordered/
    > unordered lists or even as a html table.
    >
    > Have I explained this well enough that you can understand what I
    > mean? �


    Not sure. Have you tried using <tt> tags with regular Python
    string formatting?

    > Is such a library available anywhere?
    >
    > Thanks
     
    Mensanator, Oct 17, 2009
    #2
    1. Advertising

  3. Sam schrieb:
    > I'm looking for something like the pprint module but that can take a
    > Python data structure and turn it into HTML (or better xHTML).
    >
    > It would read through the data structure but instead of formatting it
    > using spaces it would format it using either dd/dt or ordered/
    > unordered lists or even as a html table.
    >
    > Have I explained this well enough that you can understand what I
    > mean? Is such a library available anywhere?


    pprint + pygments should do the job.

    Diez
     
    Diez B. Roggisch, Oct 17, 2009
    #3
    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. Andrew Montgomery
    Replies:
    0
    Views:
    632
    Andrew Montgomery
    Sep 17, 2003
  2. John Hunter
    Replies:
    5
    Views:
    667
    Paul McNett
    Sep 28, 2004
  3. Alfonso Morra
    Replies:
    11
    Views:
    730
    Emmanuel Delahaye
    Sep 24, 2005
  4. kj
    Replies:
    2
    Views:
    2,506
    Vlastimil Brom
    Aug 5, 2010
  5. Grant Edwards
    Replies:
    0
    Views:
    198
    Grant Edwards
    Oct 25, 2011
Loading...

Share This Page