My latest torment I mean task, was to take two files from an eBook supplier for analysis. One was the eBooks we have purchased and the other was the statistics for the eBook use.
My task is to take the statistics from the one file, but only for the eBooks we own, and put them in a separate file.
After determining what field matched, the ISBN with some mass editing, and adjusting the delimiter of the files from tabs to a “|” I began the journey with Python.
My first thought was that I wold open both files and read the purchased record comparing it to the records in the statistics file, saving the matched record to a new file. Awesome idea, poor logic. Python did it great for the first purchased record, then quit reading from the statistics file.
Here is the code:
I then opted for a different logic path. Read in the purchased file first, putting all the ISBNs into a list, then read each statistics entry and compare it the ISBN list. HUZZAH it works, but it takes a long time.
Here is that code:
I have left some debugging line in and I hope I commented enough to make it easy to follow. Let me know what you think.