Python save list and read data from file
<p>Basically I would like to save a list to python and then when the program starts I would like to retrieve the data from the file and put it back into the list.
<br> 
So far this is the code I am using</p>

<pre><code>mylist = pickle.load("save.txt")
...
saveToList = (name, data)
mylist.append(saveList)
import pickle
pickle.dump(mylist, "save.txt")
</code></pre>

<p>But it just returns the following error: TypeError: file must have 'read' and 'readline' attributes</p>

<p>pickle.dump accept file object as argument instead of filename string</p>

<pre><code>pickle.dump(mylist, open("save.txt", "wb"))
</code></pre>

python