Scripting (3)


MySQL and Python3

MySQL and Python Logos

I’m using Python more and more so it’s not surprising that recently the need arose to connect to and insert into a MySQL database. I was using (and usually do) Python3, and I ran into a couple of issues in the begining. This post will document those issues and the solutions I found to get MySQL and Python3 to work together.




Writing Web Scraped HTML to a File

I was working on a project for a client where I needed to scrape data from a Web page. I wanted to save the page to a file so that I wouldn’t be making requests to the server hosting the page each time I wanted to test my code. I was using Python3 and the Requests library. When attempting to perform the write to a file, I ran into encoding issues. This task was not as straightforward as I first imagined.




Splitting a PDF into Single Pages

I recently had a request to take a PDF file which contained multiple documents – one page each – and separate the documents out into individual files. The request was in a Microsoft Windows environment. I had used Ghostscript for such tasks in the past on Linux, and has pleased to find the software was also available for DOS based systems.