I am trying to save lists (one per line) in a file like
w = meaningful_words
json.dump(w, outfile)
outfile.write("\n");
where w is a list of strings. Then I'm trying to load the lists, one at a time like
with open('text.txt', 'r') as file:
for line in file:
data = json.loads(line.read())
But I get the error
data = json.loads(line.read())
AttributeError: 'str' object has no attribute 'read'
Is there another way to do this? Found out JSON wood be easy to use but I can't get it to work.