A string can be transformed into a list using the eval() function. That said, this is not the most efficient and memory-friendly solution to the problem.

A better option is to use Python's pickle or cPickle module. "Pickling" refers to the process of saving a Python object (for example, a list or dictionary) as a byte stream which can then be quickly unloaded into variables later, without loss or deformation of its object type. Pickling is also known as "serialization" and "marshalling".