1、安装 pip install icecream
pip install icecream
PS C:\Users\pacer> pip install icecream
Collecting icecream Downloading icecream-2.1.1-py2.py3-none-any.whl (8.1 kB)
Collecting asttokens>=2.0.1 Downloading asttokens-2.0.5-py2.py3-none-any.whl (20 kB)
Collecting executing>=0.3.1 Downloading executing-0.6.0-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: pygments>=2.2.0 in d:\python36\lib\site-packages (from icecream) (2.9.0)
Requirement already satisfied: colorama>=0.3.9 in d:\python36\lib\site-packages (from icecream) (0.4.3)
Requirement already satisfied: six in d:\python36\lib\site-packages (from asttokens>=2.0.1->icecream) (1.11.0)
Installing collected packages: executing, asttokens, icecream
Successfully installed asttokens-2.0.5 executing-0.6.0 icecream-2.1.1
2、调用方法
案例解析
案例1:访问函数
如果我们需要调试函数,获取2,3,4的平方数。那么输出结果,需要这么写
print(pingfang(2))
print(pingfang
正达语文 博览焕发智慧 书香孕育达人-教育频道-东方网
eastday.com - get the latest breaking news, showbiz & celebrity photos, sport news & rumours, viral videos and top stories from eastday.com Daily Mail and Mail on Sunday newspapers.
西关街道办事处:实字当先 让爱的阳光撒进孩子们的心田_县区频道_洛阳网
lyd.com.cn - get the latest breaking news, showbiz & celebrity photos, sport news & rumours, viral videos and top stories from lyd.com.cn Daily Mail and Mail on Sunday newspapers.