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()
原文地址:https://www.cnblogs.com/amize/p/14334446.html