pysnooper.debug 发表于 2019-04-26 | 分类于 python | 阅读次数 | 输出日志文件名称1@pysnooper.snoop("test.log") 定义debug的函数调用层级1@pysnooper.snoop("test.log", depth=2) 添加非局部变量的修改记录1@pysnooper.snoop("test.log", variables=('K', 'P')) 1234567891011121314151617181920212223242526272829import pysnooperK = 0def f(i): global K K += 1 j = i ** 2 return jdef g(i): global K K += 1 j = i + f(i) return j#@pysnooper.snoop("test.main.log", depth=1, variables=('K', ))@pysnooper.snoop("test.main.log", depth=1)def main(): for i in range(4): print(g(i))if __name__ == '__main__': main() Donate WeChat Pay Alipay