[Solved] Variable in Dictionary Value String Python
[ad_1] This should do it: My_DICT = {‘Sale_Type’ : ‘Car’, ‘Sale_Length’ : 5, “Query_String” : “”} My_DICT[‘Query_String’] = “select * from Sales where Length > %s” % My_DICT[‘Sale_Length’] — EDIT — Considering your input example, you have a list of dictionaries in My_DICT. You could do it like this: for element in My_DICT: element[‘Query_String’] = … Read more