Reputation: 213
I using Python and a function give me this output:
[['2', 'prod1', 'Ela - Available'], ['2', 'prod1', 'Base - Replication logs']]
My goal it's to delete all lines contains "Available" with Python
So my goal it's to have:
[['2', 'prod1', 'Base - Replication logs']]
Upvotes: 0
Views: 608
Reputation: 5950
Try this :
data = [['2', 'prod1', 'Ela - Available'], ['2', 'prod1', 'Base - Replication logs']]
output = [line for line in data if not 'Available' in str(line)]
print(output)
[['2', 'prod1', 'Base - Replication logs']]
Upvotes: 4
Reputation: 16619
>>> l = [['2', 'prod1', 'Ela - Available'], ['2', 'prod1', 'Base - Replication logs']]
>>> filter(lambda x: not any('Available' in y for y in x), l)
[['2', 'prod1', 'Base - Replication logs']]
Upvotes: 4