I want to save a textScrollList in a file and later open that file in a textScrollList.
How can I do it in python?
What should be the format of the saved file?
saving textScrollList in a file
jbasu8
#1
djx
#2
Do you mean you just want to save the list of items in a file, or something more than that?
I usually find json is a convenient way to save simple data structures to files.
David
djx
#4
Yep. Well json should work.
# data and filepath
data = ['item1', 'item2', 'item3']
filepath = 'X:/dataStore/dataList.json'
# write to file
import json
dataFile = open(filePath, 'w')
dataFile.write(json.dumps(data))
# read back from file
data = json.load(open(filePath))
David