osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python-remove duplicate output



How to remove duplicate lines and store output into one ine

   reservations = ec.describe_instances().get('Reservations', []) 

   for reservation in reservations:
        for instance in reservation['Instances']:
            tags = {}
            for tag in instance['Tags']:
                tags[tag['Key']] = tag['Value']
                if tag['Key'] == 'Name':
                    name=tag['Value']

            if not 'Owner' in tags or tags['Owner']=='unknown' or tags['Owner']=='Unknown':
                print name

Current Output:

aws-opsworks

aws-opsworks Ansible

Desired output:

aws-opsworks Ansible