Undesired format of output in python

  python

In my program e=H.eigsh(pars=dict(para=x)) finds the one eigenvalues of matrix H for a given parameter x.

I can find the e for a set of x =(0.0, 1.0) values as following:

 x=0.0 
 while x < 2.0:
  [e]=H.eigsh(pars=dict(para=x))
  print(e)
 x=1.0

which gives the output:

-0.8
-2.2

But because of large values of x, I want to do the same thing as following:

[e]=H.eigsh(pars=dict(para=x))
o=[e for x in range (2)]
print(o)

which also gives the correct output but in undesired format:

[array([-0.8], dtype=float32), array([-2.2], dtype=float32)]

Kindly help me in getting the output without undesired items.

Source: Python Questions

LEAVE A COMMENT