python - Prettytable 0.7.2 HTML Table Not Working -


so, trying prettytable 0.7.2 working html table. can't seem working. using following:

from prettytable import from_html html = "<table><tr><th>h1</th></tr><tr><td>v1</td></tr></table>" table = from_html(html) print (table) 

which results in:

[<prettytable.prettytable object @ 0x90556ec>] 

i can table work using other methods, can't seem tackle html table method. i'm not sure if doing wrong or missing something. if shed light on issue appreciated.

the problem is, table isn't prettytable object, a list containing single prettytable object.

calling from_html function return list containing 1 prettytable per table tag encountered in html string.

you want do:

print table[0] 

which returns:

+----+ | h1 | +----+ | v1 | +----+ 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -