最佳答案
在调试时,我们经常看到这样的 print 语句:
print x # easy to type, but no context
print 'x=',x # more context, harder to type
12
x= 12
如何编写一个函数,将采取变量或变量的名称,并打印其名称和值?我只对调试输出感兴趣,这不会合并到生产代码中。
debugPrint(x) # or
debugPrint('x')
x=12