Set global output precision python

前端 未结 4 2019
清酒与你
清酒与你 2021-01-04 19:56

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 ret

4条回答
  •  独厮守ぢ
    2021-01-04 20:46

    With numpy, you could use the set_printoptions method (http://docs.scipy.org/doc/numpy/reference/generated/numpy.set_printoptions.html).

    For example:

    import numpy as np
    np.set_printoptions(precision=4)
    print(np.pi * np.arange(8))
    

提交回复
热议问题