colorz将彩色文本输出和微调器添加到windows shell(powershell/cmd)
colourz的Python项目详细描述
颜色z
colorz将彩色文本输出和微调器添加到windows shell(powershell/cmd)
安装
$ pipenv install colourz
用法
importcolourz# Print in bold textprint(colourz.bold("Bold text"))# Print text in redprint(colourz.normal("Red text","RED"))# Print text in bold redprint(colourz.bold("Bold red text","RED"))# Use Bullets when waiting on a long taskimporttimedefmain():s=colourz.Bullets()print("Doing long task...")s.start()long_task()s.stop()print("Success!")# CAUTION: As Bullets is threaded, we need to watch out for exceptionsdeflong_task():raiseLongTaskErrordefmain():s=colourz.Bullets()print("Doing long task...")s.start()try:long_task()msg="Success!"exceptLongTaskError:msg="Fail!"finally:s.stop()print(msg)