You should modify filter provided by Dead_EyE according to your needs.
One way to achieve result is convert value to int and make comparison instead. Following function filters out values which are less than in arguments given and yields only club name, not whole row:
One way to achieve result is convert value to int and make comparison instead. Following function filters out values which are less than in arguments given and yields only club name, not whole row:
def filter_by(data, **kwargs): for row in data: for key, value in kwargs.items(): if int(row.get(key)) < value: break else: yield row['Club']If not relegated (Relegated < 1) and not been first (First < 1) will break: 'filter out teams which have at least once been relegated and been first':
>>> list(filter_by(data, Relegated=1, First=1)) ['Manchester City']You can see that this is not very easily understandable. So one should take extra step to think through what and how to achieve desired result in easy to understand way.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.