Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




File Format Exercises

  1. Create An Office Suite Result. Back in the section called “Iteration Exercises” we used the for statement to produce tabular displays of data. This included How Much Effort to Produce Software?, Wind Chill Table, Celsius to Fahrenheit Conversion Tables and Dive Planning Table. Update one of these programs to produce a CSV file. If you have a desktop office suite, be sure to load the CSV file into a spreadsheet program to be sure it looks correct.

  2. Proper File Parsing. Back in the section called “File Exercises” we built a quick and dirty CSV parser. Fix these programs to use the CSV module properly.

  3. Configuration Processing. In the section called “Stock Valuation”, we looked at a program which processed blocks of stock. One of the specific programs was an analysis report which showed the value of the portfolio on a given date at a given price. We make this program more flexible by having it read a configuration file with the current date and stock prices.

  4. Office Suite Extraction. Most office suite software can save files in XML format as well as their own proprietary format. The XML is complex, but you can examine it in pieces using Python programs. It helps to work with highly structured data, like an XML version of a spreadsheet. For example, your spreadsheet may use tags like <Table>, <Row> and <Cell> to organize the content of the spreadsheet.

    First, write a simple program to show the top-level elements of the document. It often helps to show the text within those elements so that you can correlate the XML structure with the original document contents.

    Once you can display the top-level elements, you can focus on the elements that have meaningful data. For example, if you are parsing spreadsheet XML, you can assembled the values of all of the <Cell>'s in a <Row> into a proper row of data, perhaps using a simple Python list.

  Published under the terms of the Open Publication License Design by Interspire