I am trying to save array of lists to a text file and then read them back to a list with all the original formatting preserved. The output list 'content' should be exactly the same as the input list 'times'.
times = [('7:00 AM', 'F'), ('7:10 AM', 'F'), ('7:20 AM', 'F'), ('7:30 AM', 'F'), ('7:40 AM', 'F'), ('7:50 AM', 'F'), ('8:00 AM', 'F'), ('8:10 AM', 'F'), ('8:20 AM', 'F'), ('8:30 AM', 'F'), ('8:40 AM', 'F'), ('8:50 AM', 'F'), ('9:00 AM', 'F')]
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
array = np.array(times)
print("array",array)
np.savetxt("C:/Users/micha/source/repos/Times_Array.txt",array,fmt="%s")
content = np.genfromtxt('C:/Users/micha/source/repos/Times_Array.txt',delimiter=",",dtype=None,encoding = 'UTF-8')
print("\ndata.txt content:\n",content)
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
array [['7:00 AM' 'F']
['7:10 AM' 'F']
['7:20 AM' 'F']
['7:30 AM' 'F']
['7:40 AM' 'F']
['7:50 AM' 'F']
['8:00 AM' 'F']
['8:10 AM' 'F']
['8:20 AM' 'F']
['8:30 AM' 'F']
['8:40 AM' 'F']
['8:50 AM' 'F']
['9:00 AM' 'F']]
data.txt content:
['7:00 AM F' '7:10 AM F' '7:20 AM F' '7:30 AM F' '7:40 AM F' '7:50 AM F'
'8:00 AM F' '8:10 AM F' '8:20 AM F' '8:30 AM F' '8:40 AM F' '8:50 AM F'
'9:00 AM F']
The output format in the list 'content' is not the same as the input list 'times'.. How do I get input to equal output with the same format?