In this iteration, we will use third-party Python modules to further automate our SQL and HTML setup. This will introduce extra overhead; however, our script will be simpler to implement and more streamlined, which would allow us to more easily develop further functionality in the future. Developing with an eye towards the future helps prevent us from rewriting the entire script for every minor feature request.
We have imported the majority of the standard libraries required before and added the third-party unicodecsv
module (version 0.14.1
). This module wraps around the built-in csv
module and automatically provides the Unicode support for the CSV output. To keep things familiar, we can even name it csv by using the import...as...
statement on line 4. As this is a third-party library, it will need to be installed on the user's machine for our code to run properly and can be done so with pip.
001 import os 002 import sys 003 import logging...