I'm trying to make a tracker program of sorts, and i'm using a bunch of lists, but i can't save the values i'm putting into the lists. I need to save the lists in a way that i can run and re-run the program keeping the input values in the list.
Asked
Active
Viewed 68 times
0
-
You can either save them in a text file (.txt, .csv, etc) or pickle them. – Kostas Mouratidis May 30 '18 at 16:45
-
2Welcome to Stack Overflow. Please read the [Asking Guide](https://stackoverflow.com/help/how-to-ask), and in particular the part about [creating a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). Show us your code and outline explicitly what you've tried and what is not working. – Mihai Chelaru May 30 '18 at 16:45
-
Either what @KostasMouratidis said, or a database. SQLite is a good place to start for beginners. – mypetlion May 30 '18 at 16:46
-
You're looking for "serialization." See [this answer](https://stackoverflow.com/questions/25464295/how-to-pickle-a-list) – Adam Smith May 30 '18 at 16:49
-
if it's just lists [`json`](https://docs.python.org/2/library/json.html) is good too – bobrobbob May 30 '18 at 16:59
-
1@bobrobbob unless they're lists of arbitrary Python objects :) But yes, lists of strings, numbers, bools, and sublists of the same are perfect for JSON. – Adam Smith May 30 '18 at 17:17