Re: Need help with getting Key, Value out of dicts in lists

2017-04-10 Thread John Ralph
There are a number of ways to reorganise the data for the exclusive use of your script without affecting the original data. Is there a reason you can't or not allowed to do this? Regardless, here's some code that might make things a little easier. It operates on each balancer on the fly,

Re: Need help with getting Key, Value out of dicts in lists

2017-04-09 Thread Irv Kalb
OK, I did't know if you were able to re-organize the data. I know nothing about AWS load balancers, but it's unfortunate that the data is laid out in a way that makes dealing with it difficult. But it sounds like you have worked it out. Best of luck. Irv > On Apr 9, 2017, at 2:21 PM,

Re: Need help with getting Key, Value out of dicts in lists

2017-04-09 Thread Kenton Brede
Thanks for the response Irv. On one level I'm glad to know that someone more knowledgeable than myself sees this data structure as difficult. :) I was thinking it was an easy problem to solve. Unfortunately that is the structure I have to use. The data comes from pulling back tag information

Re: Need help with getting Key, Value out of dicts in lists

2017-04-09 Thread Peter Otten
Kenton Brede wrote: > This is an example of the data I'm working with. The key/value pairs may > come in any order. There are some keys like the 'Resource_group_id' key > and the 'Name' key which will always be present, but other lists may have > unique keys. > > alist = [[{u'Value':

Re: Need help with getting Key, Value out of dicts in lists

2017-04-08 Thread Irv Kalb
[ Sorry, forgot the important stuff! ] What you want to do is tricky because your data structure is difficult to deal with. My guess is that it has to do with a misconception about how a Python dictionary works. Yes, it is a series of key/value pairs, but not the way you have it. It looks

Re: Need help with getting Key, Value out of dicts in lists

2017-04-08 Thread Irv Kalb
> On Apr 8, 2017, at 5:55 PM, Kenton Brede wrote: > > This is an example of the data I'm working with. The key/value pairs may > come in any order. There are some keys like the 'Resource_group_id' key and > the 'Name' key which will always be present, but other lists may have

Need help with getting Key, Value out of dicts in lists

2017-04-08 Thread Kenton Brede
This is an example of the data I'm working with. The key/value pairs may come in any order. There are some keys like the 'Resource_group_id' key and the 'Name' key which will always be present, but other lists may have unique keys. alist = [[{u'Value': 'shibboleth-prd', u'Key': 'Name'},