小编Cha*_*hao的帖子

使用Python创建一个HTML表,其中包含特定行的多列

我写了这段代码:

tr = ""
for author, projects in data.iteritems():
    tr + = "<tr><td>{}</td>".format(author)
    for project, branches in projects.iteritems():
        tr += "<td>{}</td>".format(project)
        for branch in branches:
            tr += "<td>{}</td>".format(branch)
    tr += </td></tr>
end = "</table>"
Run Code Online (Sandbox Code Playgroud)

我有这个数据集

{
'user_one': {'project_a': ['branch_1', 'branch_2'],
          'project_b': ['branch_1']},
'user_two': {'project_x': ['branch_x1', 'branch_b'] }
}
Run Code Online (Sandbox Code Playgroud)

我想打印如下表格:

+-------------------------------------------+
|    User    |    Project    |    Branch    |
+------------+---------------+--------------+
|  user_one  |   project_a   |   branch_1   |
+------------+---------------+--------------+
|            |               |   branch_2   |
+------------+---------------+--------------+
|            |   project_b   |   branch_1   |
+------------+---------------+--------------+
| …
Run Code Online (Sandbox Code Playgroud)

python html-table tablecolumn

5
推荐指数
1
解决办法
3920
查看次数

如何清除pyqt5中qtextbrowser的内容?

如何清除 的内容QTextBrowser?我尝试过clearHistory()以及设置光标选项但没有帮助

有谁知道如何清除Qtextbrowser的内容

python-3.x pyqt5

3
推荐指数
1
解决办法
3988
查看次数

标签 统计

html-table ×1

pyqt5 ×1

python ×1

python-3.x ×1

tablecolumn ×1