Skip to content

Tag: python

Turn List of Dictionaries into Dictionary of Dictionaries with index

I have a list of dictionaries, like this: Which produces this: What I want is a dictionary of dictionaries where each dictionary is indexed like the following: The additional problem is that I need to convert the former to the latter, rather than adapting my sample creation code, as I just spent 15 hours down…

How to put db name into query using %s

I have a following sql query: The tableA is in db-jablonec so I need to call db-jablonec.tableA. I use this method in Python: I call it like this: But I got an error MySQLdb.ProgrammingError: (1146, “Table ”db-jablonec’.tableA’ doesn’t exist”) Obviously, I want to call &#82…