Hi, I have generated an array of random numbers and I'm trying to then write this array to a .txt file but the code I have written doesn't seem to do this correctly. I'm fairly new to python so any help on this would be great. Here is what I have so far:
Code:
import numpy as N import random def main(): n=10 size=1500 initial=N.zeros([n,3], dtype=N.float64) filename="positions.txt" for i in range(n): for j in range(0,3): initial[i,j]=random.randrange(0,size) file=open(filename,'w') file.write(initial) file.close()
Comment