[Python] How to render raw html in the PyHTML library

Discussão em 'Python' iniciado por Stack, Fevereiro 2, 2025.

  1. Stack

    Stack Membro Participativo

    I am not able to render a table generated by the pandas .tohtml() function into my pyhtml generated code.

    s = h.html(
    h.head(
    h.title("Student Data")
    ),
    h.body(
    h.h1(
    "Student Details"
    ),
    (sdf.to_html(index=False))
    )
    )


    This is what I tried, ends up giving me the table as a string. Heard about a raw() method, but the current version just says its not existent.

    (

    <table border="1" class="dataframe">
    <thead> <tr style="text-align: right;">
    <th>Student id</th> <th>Course id</th> <th>Marks</th> </tr>
    </thead>
    <tbody>
    <tr> <td>1002</td> <td>2001</td> <td>67</td> </tr>
    </tbody>
    </table>


    This is the approx structure of my html table)

    Continue reading...

Compartilhe esta Página