My text file has a single line that will be overwritten from time to time. The actual value is:
5,7,1,1,6,7,27
I want to read this *.txt and place its content inside a np.array, so that it would be:
new = np.array([[5,7,1,1,6,7,27]])
What I tried:
import numpy as np
from pathlib import Path
txt = Path('c:\MyFolder\myValue.txt').read_text()
new = np.array([[txt]])
How to correct this?
print(txt)to see what this object actually is.print(txt)and it showed 5,7,1,1,6,7,27. Whenprint(new)it showed [['5,7,1,1,6,7,27']]