I've written a library of functions to make my engineering homework easier, and use them in the python interpreter (kinda like a calculator). Some return matrices, some return floats.
The problem is, they return too many decimals. For example, currently, when a number is 0, I get an extremely small number as a return (e.g. 6.123233995736766e-17)
I know how to format outputs individually, but that would require adding a formatter for every line I type in the interpreter. I'm using python 2.6.
Is there a way to set the global output formatting (precision, etc...) for the session?
*Note: For scipy functions, I know I can use
scipy.set_printoptions(precision = 4, suppress = True)
but this doesn't seem to work for functions that don't use scipy.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…