Q:

Prettytable 0.7.2 HTML Table Not Working

So, I am trying to get Prettytable 0.7.2 working with an HTML table. I just can't seem to get it working. I am using the 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 at 0x90556ec>]

I can get the table to work using the other methods, but I can't seem to tackle the HTML table method. I'm not sure if I am doing something wrong or missing something. If anyone could shed some light on this issue it would be much appreciated.

A:

The problem is, table isn't a PrettyTable object, but a list containing a single PrettyTable object.
Calling the from_html function will return a list containing one PrettyTable per table tag encountered in your html string.
You want to do:
print table[0]

Which returns:
+----+
| h1 |
+----+
| v1 |
+----+

