console.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:esmcheckds2 作者: andywalden 项目源码 文件源码
def lol_to_table(lol, format=None, headers=None):
    """
    Args:
        lol (list): list of lists
        format (str): text
        headers (list): list of fields to be used as headers

    Return:
        obj - prettytable object

    """
    table = PrettyTable(field_names=headers)
    for ds_row in lol:
        table.add_row([f for f in ds_row])
    if format == 'text': 
        table.set_style(PLAIN_COLUMNS) 
    if format == 'word': 
        table.set_style(MSWORD_FRIENDLY)
    table = table.get_string()
    return table
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号