On Sun, Jun 1, 2008 at 7:03 AM, bob gailer <[EMAIL PROTECTED]> wrote:
> Even more concise and possibly faster:
>
> data = open('out.out').read().replace('\n', '\\').split('\\')
Or use re.split() to split without the replace:
import re
data = open('out.out').read()
data = re.split(r'[\n\\]',
Kent Johnson wrote:
On Sat, May 31, 2008 at 3:43 PM, Bryan Fodness <[EMAIL PROTECTED]> wrote:
I am trying to read a long string of values separated by a backslash into an
array of known size.
Here is my attempt,
from numpy import *
ay, ax = 384, 512
a = zeros([ay, ax])
for line in open('out
On Sat, May 31, 2008 at 3:43 PM, Bryan Fodness <[EMAIL PROTECTED]> wrote:
> I am trying to read a long string of values separated by a backslash into an
> array of known size.
>
> Here is my attempt,
>
> from numpy import *
> ay, ax = 384, 512
> a = zeros([ay, ax])
> for line in open('out.out'):
>
I am trying to read a long string of values separated by a backslash into an
array of known size.
Here is my attempt,
from numpy import *
ay, ax = 384, 512
a = zeros([ay, ax])
for line in open('out.out'):
data = line.split('\\')
k = 0
for i in range(ay):
for j in range(ax):
a[i, j