wallabag_show.py 文件源码

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

项目:wallabag-cli 作者: Nepochal 项目源码 文件源码
def __format_text(text):
    try:
        maxcol = os.get_terminal_size().columns
    # piped output to file or other process
    except OSError:
        maxcol = sys.maxsize

    ret = ""

    for line in text.splitlines():
        ios = io.StringIO()
        writer = formatter.DumbWriter(ios, maxcol=maxcol)
        writer.send_flowing_data(line)
        ret = "{0}{1}\n".format(ret, ios.getvalue())
        ios.close()

    return ret
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号