dimanche 23 mars 2014

How to append item to a list in another file and save that file with updated list


Vote count:

0




I have a python file (list.py) that has list as follows:



letters=['A','B','C']


I would like to be able to open and add next letter 'D' to letters and then save the updated list.py so that it will have the following list:



letters=['A','B','C','D']


that I will access and update in the future.


I tried to import list and use f.write but it saves output as string.





asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire