I have a large dictionary that is a created using a SQL select statement and .Dictcursor. It creates a dictionary of all the elements and the columns in the a format like this.
{'EXAMPLE1': 'true',
'EXAMPLE2': 'text',
'EXAMPLE3': 'text',
'EXAMPLE4': 'true',
'EXAMPLE5': 'string'},
I want to replace the ' with " so it will work with SQL's syntax.
{"EXAMPLE1": "true",
"EXAMPLE2": "text",
"EXAmPLE3": "text",
"EXAMPLE4": "true",
"EXAMPLE5": "string"},
I am generating the dictionary using this method
c = db.cursor(pymysql.cursors.DictCursor)
c.execute(sql)
data=c.fetchall()
c = db.cursor()
db.commit()
c.close()
pprint.pprint(data)
I am using Python3.8 and MySQL.