reading matrix from a file

Francesc Altet faltet at carabos.com
Wed Nov 8 09:01:31 CST 2006


A Dimecres 08 Novembre 2006 15:55, Charles R Harris escrigué:
> Try
>
> In [8]: tmp = fromfile('tmp.txt', sep=' ', dtype=int)
>
> In [9]: a = tmp[:4].reshape(2,2)
>
> In [10]: b = tmp[4:].reshape(2,2)
>
> In [11]: a
> Out[11]:
> array([[1, 2],
>        [3, 9]])
>
> In [12]: b
> Out[12]:
> array([[2, 3],
>        [4, 4]])

Yeah. Much, much better indeed.

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


More information about the Numpy-discussion mailing list