[Tutor] writing list to new file

Alan Gauld alan.gauld at freenet.co.uk
Mon Feb 14 10:54:46 CET 2005


> If line.startswith('XXX'):
>             save list to new file
> 
> But I get errors saying only stings can be saved this
> way. 


You can save the list if the list can be printed, but 
its usually better to save the list contents. You will 
need to convert the contents into strings or else use 
a binary file.

See my tutor topic on handling files for more, it 
includes an examople of saving an address book...

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld


More information about the Tutor mailing list