答应我!忘了他吧!不要再用print了,我用冰激凌ic调试Python养你_lexsaints-CSDN博客
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(3)) print(pingfang(4)) 输出结果如下: