0

I have an array of numbers in python. I saved it using the code below

file = open("A.txt", "w+")
 

for i in range(300):
    content = str(A[i])
    file.write(content)


file.close()

But when I wanted to read it with this code

def readFile(A):
        fileObj = open('A.txt', "r") #opens the file in read mode
        words = fileObj.read().splitlines() #puts the file into an array
        fileObj.close()
        return words

it turned out that I cant use it as a NumPy array again. How to proceed with this task.

Supposing my array is the following one, I would appreciate your tips.

A=vp.array([[1,2],[3,4]])
Sik Sik
  • 91
  • 6

0 Answers0