For the case of a small array, you can use repr(). This will work as long as the array is not clipped (it is small enough).
>>> a=np.arange(10) >>> print a [0 1 2 3 4 5 6 7 8 9] >>> repr(a) 'array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])' >>> a=np.arange(10000) >>> a.resize((100,100)) >>> print a [[ 0 1 2 ..., 97 98 99] [ 100 101 102 ..., 197 198 199] [ 200 201 202 ..., 297 298 299] ..., [9700 9701 9702 ..., 9797 9798 9799] [9800 9801 9802 ..., 9897 9898 9899] [9900 9901 9902 ..., 9997 9998 9999]] >>> repr(a) 'array([[ 0, 1, 2, ..., 97, 98, 99],\n [ 100, 101, 102, ..., 197, 198, 199],\n [ 200, 201, 202, ..., 297, 298, 299],\n ..., \n [9700, 9701, 9702, ..., 9797, 9798, 9799],\n [9800, 9801, 9802, ..., 9897, 9898, 9899],\n [9900, 9901, 9902, ..., 9997, 9998, 9999]])' David. On Sat, Oct 20, 2012 at 1:11 PM, Neal Becker <ndbeck...@gmail.com> wrote: > I find it annoying that in casual use, if I print an array, that form can't be > directly used as subsequent input (or can it?). > > What do others do about this? When I say casual, what I mean is, I write some > long-running task and at the end, print some small array. Now I decide I'd > like > to cut/paste that into a new program. > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion