I have a Python script which creates a large SQL insert file of about 300,000 lines. The problem with this is that the last line of the file ends up looking like this:
'),
Which results in a SQL error as it is expecting a closing semicolon.
I am looking for an efficient way to open the file to replace the comma with a semicolon on the last line.