I have written code as:
array = [[1.630217208498539], [0.019929319226538452]]
fo = open("file.txt", "w")
fo.write(str(array))
fo.close()
That will save the array in .txt file, the content in the .txt file is in 2d array as:
[[1.630217208498539], [0.019929319226538452]]
And I want this array as it is back to the another program so that i can use this array for further calculation (the read array should not be a string)
解决方案import pickle
numlist = [[1.630217208498539], [0.019929319226538452]]
outfile = open("log.txt", "wb")
pickle.dump(numlist, outfile)
outfile.close()
infile = open("log.txt", "rb")
pickle.load(infile)
[[1.630217208498539], [0.019929319226538452]]