On Wed, 22 Jul 2015 07:12 am, max scalf wrote: > Hello all, > > For Each SecurityGroup, how can i convert that into a List that in turn > will have a dictionary of the cidr block, protocol type and the port...
Start with this: def sg_to_list(sg): return [rule_to_dict(r) for r in sg.rules] def rule_to_dict(rule): d = {} # expected {'cidr': '0.0.0.0/0', 'proto': 'tcp', 'port': 80} d['cidr'] = rule.cidr d['proto'] = rule.proto d['port'] = rule.port return d and adjust until working. -- Steven -- https://mail.python.org/mailman/listinfo/python-list