轻量终端打印工具:wasabi

2019-12-18 16:39:16 浏览数 (1)

可以用于终端打印一些信息

安装

代码语言:javascript复制
pip install wasabi

代码以及对应的执行效果

代码语言:javascript复制
from wasabi import Printer

msg = Printer()
msg.text("Hello world!")

msg.good("Success")
msg.fail("Error")
msg.warn("Warning")
msg.info("Info")

msg.divider("Heading",char='-')

import time
with msg.loading("Loading..."):
    # Do something here that takes longer
    time.sleep(3)
msg.good("Successfully loaded something!")

from wasabi import color

formatted = color("This is a text", fg="white", bg="green", bold=True)
print(formatted)

from wasabi import wrap

wrapped = wrap("Hello world, this is a text.", indent=2)
print(wrapped)

0 人点赞