In your experience, what's the best way to store a 2-dimensional array into a text file? My matrix is pretty huge, but let's use a small 3 x 3 matrix as an example. One could store it, quite literally, like this (to the .txt file):
3 7 5 2 9 8 8 0 1 with a space between elements of the same row, and a newline character to separate the rows themselves from each other. And then if you want to use this saved matrix with a different python file, you'd just parse accordingly.
However, is there a much better (for instance, a way that requires few lines of code) way to store and retrieve a large matrix?
[EDIT]: Right, now I have a list of lists (or, an array of arrays), but I'm open to the idea of using numpy if that makes things a lot easier
numpy, or do you really have a list of lists?{}button in the editor.listandarrayaren't synonyms in Python.listis a built-in type; there's anarray.arraytype, also built in; and there'snumpy.ndarray, also often calledarray.