'%H:%M') record.append(endTime) startTime = record[-2][0:hyphenInd] startTime = datetime.strftime(datetime.strptime(startTime, '%I:%M %p'), '%H:%M') record[-2] = startTime #get instructor, date, and location record += scraper.data[i][16:17] record += scraper.data[i][-4:-2] if record[-3].strip() != "Instructor": # instructor field is in the format 'professor name (', reformatting it to remove the paranthesis record[-3] = record[-3][0:-2] cData.append(record) #the following code assumes that the sql table 'courses' has the same structure of this data (column count and type) sql = MySqlAccess("localhost", "root", "", "courses_db") print("The following queries could not be entered:") print("---------------------------------------------") for record in cData: if record[0] == "Subj": continue query = "INSERT INTO courses VALUES(" for item in record: query += "'" + item + "'," query = query[0:-1] + ")" try: sql.query(query) except: print(query) sql.conn.close()