format reader/writer reader writer lines of code total lines of code output file size (~kbbinary pickle (gzip compressed binary pickle binary manual (gzip compressed binary manual plain text regex reader/manual writer plain text manual xml element tree xml dom xml sax reader/manual writer figure aircraft incident file format reader/writer comparison this first three sections all use the same data collectiona set of aircraft incident records figure shows the namesdata typesand validation constraints that apply to aircraft incident records it doesn' really matter what data we are processing the important thing is that we learn to process the fundamental data types including stringsintegersfloating-point numbersbooleansand datessince if we can handle these we can handle any other kind of data by using the same set of aircraft incident data for binarytextand xml formatsit makes it possible to compare and contrast the different formats and the code necessary for handling them figure shows the number of lines of code for reading and writing each formatand the totals the file sizes are approximate and based on particular sample of aircraft incident records compressed binary file sizes for the same data saved under different filenames may vary by few bytes since the filename is included in the compressed data and filename lengths vary similarlythe xml file sizes vary slightly since some xml writers use entities (&quotfor and &aposfor 'for quotes inside text dataand others don' the first three sections all quote code from the same programconvert-incidents py this program is used to read aircraft incident data in one format and to write it in another format here is the program' console help text (we have reformatted the output slightly to fit the book' page width usageconvert-incidents py [optionsinfile outfile the data we used is based on real aircraft incident data available from the faa ( government' federal aviation administrationwww faa gov