我有一个计算数学函数的函数。在调试中我想
def function(a, b, c):
"""
compute a numerical function of a, b, c
using complex math functions g, h
"""
d = g(a)
e = h(b, c)
return d*sin(e)
在main中,这个函数被多次调用
for a in range(0, 50):
print d*e
函数没有返回我所期望的,我想看看中间变量d,e对于不同的参数是如何变化的。你知道吗
我在函数中添加了简单的print语句(print d,print e),但这并不方便,因为我想为a的每个值绘制d和e。有没有方法将d和e写入文件,以便在运行主.py我可以很容易地加载输出和作出一个阴谋?你知道吗
我也试过了
def function(a, b, c):
"""
compute a numerical function of a, b, c
using complex math functions g, h
"""
d = g(a)
e = h(b, c)
logging.debug(str(d)+','+str(e))
return d*sin(e)
以及
logging.basicConfig(filename='test.log',level=logging.DEBUG)
for a in range(0.0, 50.0):
print d*e
但是我到处都找不到日志文件。你知道吗
干杯,迈克
目前没有回答
相关问题 更多 >
编程相关推荐