Writing something in a text file is simple. You can use pickle to kind of encode the data -
Hopes this helps
import pickle file = open('file.txt', 'wb') #'wb' means write bytes pickle.dump(file, variable) #dump means to save it in there file.close() file = open('file.txt', 'rb') #"rb" means read bytes variable = pickle.load(file)
Hopes this helps