def _list2table(lst, escape=True):
"""Turn a list into an HTML table (to be used as a DOT label)."""
table = '<<table border="0" cellborder="0">{}</table>>' # table HTML format
row = '<tr><td align="center">{}</td></tr>' # row HTML format
escape_function = html.escape if escape else lambda x: x
return table.format("\n".join(map(row.format, map(lambda x: escape_function(str(x)), lst or [""]))))
评论列表
文章目录