How to print a numpy.array in one line?

后端 未结 3 1139
感动是毒
感动是毒 2021-02-19 18:34

I tested PyCharm and IDLE, both of them print the 7th number to a second line.

Input:

import numpy as np
a=np.array([ 1.02090721,  1.02763091,  1.038993         


        
3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-19 19:14

    Type cast to a list when printing.

    import numpy as np
    a=np.array([ 1.02090721,  1.02763091,  1.03899317,  1.00630297,  1.00127454, 0.89916715,  1.04486896])
    print(list(a))
    

    This will print on a single line.

提交回复
热议问题