Using Python’s DictCursor in MySQL to Return a Dict with Keys
The default MySQLdb library in Python only returns an array of values in the order you retrieve them. Here is an example: While that does the job, being able to call the fields using employee[‘name’], employee[‘position’] and employee[‘age’] makes a lot more sense. Here is how to use Python’s MySQLdb’s cursor library to return a …
Using Python’s DictCursor in MySQL to Return a Dict with Keys Read More »