Question: I know this is a frequently asked question, however I do not have access to the Counter module as I'm using v2.6 of Python. I want to count the number of time a specific key appears in a list of dictionaries.

If my dictionary looks like this:

```
data = [{'a':1, 'b':1}, {'a':1, 'c':1}, {'b':1, 'c':1}, {'a':1, 'c':1}, {'a':1, 'd':1}]

```

How would I find out how many times "a" appears? I've tried using len, but that only returns the number of values for one key.

```
len(data['a'])

```

Answer: 
A one-line solution could be:

`len([k for d in data for k in d.keys() if k == 'a'])`
For this you could write the following function that would work for data in the structure you provided (a list of dicts):

```
def count_key(key,dict_list):
    keys_list = []
    for item in dict_list:
        keys_list += item.keys()
    return keys_list.count(key)

```

Then, you could invoke the function as follows:

```
data = [{'a':1, 'b':1}, {'a':1, 'c':1}, {'b':1, 'c':1}, {'a':1, 'c':1}, {'a':1, 'd':1}]
count_a = count_key('a',data)

```

In this case, count\_a will be 4.