Page 1 - Lesson Note-DFH-Binary & CSV File
P. 1

Computer Science

                                      Chapter – Data File Handling

                                            Topic: Binary and CSV Files
                                                       Class – XII

               Binary File Operations

               For writing the content of class or dictionary and to read it, we need to use the Python
               module pickle.
               Pickling is the process of converting the structure to a byte stream before writing to the file.
               Unpickling is the reverse process, reading the contents of the file, it is used to convert the
               byte stream back to the original structure.
               Pickle module can be used to store any kind of object in a file, it stores object with its
               structure.


































               Relative and Absolute Path

               Files are organised into directories/folders.
               Every running program has a current directory and it is the default directory for most of the
               operations.

               While opening a data file, languages look for the data file in the current directory.
               The os(operating system) module provides functions for working with files and directories.
               os.getcwd() – returns the name of the current directory

               Path – The string that identifies the location of a file is the path of the file its like address of
               the file.
   1   2   3   4