Python-remove duplicate output
drvucanovic at gmail.com
drvucanovic at gmail.com
Wed Nov 21 18:10:14 EST 2018
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
More information about the Python-list
mailing list