I have the following data, currently stored in a Python list:
formant_data = [
'ɑ',
125, 150, 10,
580, 50, 10,
780, 50, 9,
1010, 50, 10,
2530, 100, 9,
4400, 150, 8,
5300, 200, 8,
5880, 200, 7,
7420, 200, 7,
8860, 200, 7,
'a',
168, 120, 10,
680, 50, 9,
1000, 50, 9,
1500, 150, 8,
2500, 200, 7,
5200, 800, 7,
7200, 400, 6,
8500, 400, 6,
'ɛ',
150, 120, 10,
700, 50, 8,
750, 50, 8,
1800, 150, 8,
]
And I am unpacking it as follows:
import numpy as np
vowels = deque()
acc = deque()
for x in reversed(formant_data):
if isinstance(x,str):
symbol = x
print(symbol)
data = np.reshape( acc, (-1,3) )
vowels.appendleft(data)
acc.clear()
else:
acc.appendleft(x)
return vowels
I wish to move the data into a text file, and read it in.
What's the simplest way to do it?
I don't mind fiddling around with the data file format. The main objective is that it be easily readable.
EDIT: Maybe I can just save it as data.py
and import data.py
? problem: I want it to reside in input/data.py
EDIT: %run magic?