python_pysnooper的使用

1.安装pip install pysnooper

2.使用方法

#! /usr/bin/python3
import pysnooper
@pysnooper.snoop()
def hello(a,b):
  tmp = a + b
  tmp += 'tmp'
  print(tmp)

执行hello.py

it@it-HP-348-G3:~/test$ python3 hello.py
Source path:... hello.py
Starting var:.. a = 'ten'
Starting var:.. b = '1234'
18:12:38.539838 call         4 def hello(a,b):
18:12:38.540021 line         5   tmp = a + b
New var:....... tmp = 'ten1234'
18:12:38.540070 line         6   tmp += 'tmp'
Modified var:.. tmp = 'ten1234tmp'
18:12:38.540120 line         7   print(tmp)
ten1234tmp
18:12:38.540173 return       7   print(tmp)
Return value:.. None

猜你喜欢

转载自www.cnblogs.com/n-n5980/p/12576311.html