python insert var into dict [closed]

  python, python-3.8, python-3.x

I have following dict, where Incoming Inspection Report is the table name.

querystring = {"q":"Select * from "Incoming Inspection Report"","format":"json","headers":"true","metadata":"true","arrays":"false","page":"1","per_page":"20000"}

how can I construct the querystring dynamically for multiple tables ?
I tried .format string,

table_name = 'Incoming Inspection Report'
querystring = '{"q":"Select * from "{table}"","format":"json","headers":"true","metadata":"true","arrays":"false","page":"1","per_page":"20000"}'.format(table=table_name)

but didn’t work.

Source: Python Questions

LEAVE A COMMENT