Friday, April 24, 2015

Pickling and Shelving Data

The following program stores data to a .dat file rather than a .txt file. To store more complex information, such as lists, .dat files are used. The shelf module allows you to randomly access data. It basically takes pickled data one step further by making a dictionary out of the lists which can be randomly accessed.



Thursday, April 23, 2015

Writing to a text file

The following program write three lines and creates a text file. The writelines method can be used to write lines from a list to a text file.