When debugging, we often see print statements like these:
print x # easy to type, but no context
print 'x=',x # more context, harder to type
12
x= 12
How can write a function that will take a variable or name of a variable and print its name and value? I'm interested exclusively in debugging output, this won't be incorporated into production code.
debugPrint(x) # or
debugPrint('x')
x=12
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…