If tmp
is a string of k1 = v1
pairs, one per line, you'll need to parse those out into pairs:
result = {}
for result in query:
key, value = result.split('=', 1)
result[key.strip()] = value.strip()
This presumes your query returns individual 'key1=value1'
strings to split out into key and value pairs.
Only use result.update()
with a sequence of key-value pairs, or another dictionary. Just passing in a string won't work; Python treats the string as a sequence of one-character strings, and a one-character string does not fit the requirement for a key-value pair.