Thank your, but:
If the initial list is:
>>> a
' 0.000000000E+00 1.806088833E-02-4.959341557E+07 0.000000000E+00
0.000000000E+00\n'

y = np.fromstring(a2,sep=' ')

>>> y
array([  0.00000000e+00,   1.80608883e-02,  -4.95934156e+07,
         0.00000000e+00,   0.00000000e+00])
It works perfectly.
But if the initial list is like:
>>>b
'-2.754367381E-182.028474614E-02 6.959906258E+10 -1.390014546E-01
0.000000000E+00\n 7.484873918E-06 0.000000000E+00 0.000000000E+00
5.132910511E-03 9.159690889E-03\n 5.247460000E-03 -3.938080000E-03
-4.047670000E-03 0.000000000E+00 0.000000000E+00\n\n'
>>>np.fromstring(b,sep='  ')
array([ 0.])

>>>np.fromstring(b,sep=' ')
array([  8.56506822e-072,   2.92021791e-033,   2.25187638e+006, ...,
         6.99021630e-077,   1.39804329e-076,   2.66133772e-260])

It doesn't work in anyway.

Maybe because of the \n? Do I have to put them off before trying fromstring?

2009/4/22 Jouni K. Seppänen <j...@iki.fi>

> darkside <in.the.darks...@gmail.com> writes:
>
> >>>> x = np.fromstring(b,sep='')
>
> That should be sep=' ' (a space) to make it read ASCII representations
> of numbers. Otherwise it will interpret the string as binary, and if the
> string length happens to be a multiple of 8, you get garbage data,
> otherwise it raises the following exception:
>
> > ValueError: string size must be a multiple of element size
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
>
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to