Python Merge Dictionary from Mysql Results -
I am trying to merge the output of 7 MySQL queries and merge them into a specific field (first, ID) .
My first initial idea was to get the results of seven questions and put them in the form of a key with the first field and then the balance as the value.
returnDict Once I get results in my own Dikts with seven questions, I can combine them. I =============== ================================================== ==== I in one of the following words: for D (first sentence, second decit, third digit, fourth dict, fifth show, sixth appearance, seventh appearance): For the key, value in d.iteritems (): dd [key]. Append (value) Now, the only problem is my When combines the above Code, it does not exclude the original dictionary, it only adds to them, thus creating a very nasty dictionary.
This is what it looks like:
6: ('blah.net', datetime.datetime (20 11, 6, 23, 0, 0), 4 L, 1 L, datetime.datetime (2011, 6, 23, 0, 0)), ('Foo', 1 L), ('Unknown Foo', 2 L), (datetime This is what I want to see:
6: 'blah.net', datetime.datetime (2011, 6, 23, 0, 0), 4L, 1L, datetime.datetime (2011, 6, 23, 0, 0), 'Foo', 1 L, 'Unknown Foo', 2 L, Data Timediet (2013, 11, 14, 12, 30, 24), 'Basic Category 3'
The simplest solution Includes using a union query on behalf of the database .
If you want to do it in Python, then I will do something like value for value in To import the default Detox DD = Default Dict (List First Dict, Second Decit, ...)
Comments
Post a Comment