python 替代print调试


# 安装 
pip install icecream


# 使用
from icecream import ic

# 可以配置函数
# import time
# def unixTimestamp():
#     return '%i |> ' % int(time.time())
#
# ic.configureOutput(prefix=unixTimestamp)

# 直接配置字符串
ic.configureOutput(prefix='hello -> ')


d = {'key': {1: 'one'}}

def foo(i):
    return i + 333

# 调用方法
ic(d['key'][1])
ic(foo(123))
ic()
posted @ 2021-01-27 13:14  该显示昵称已被使用了  阅读(173)  评论(0编辑  收藏  举报