After researching similar questions, I was not able to find a definite answer as to how this is done or if it even can be done. I am trying to count the number of occurrences in an output that are in my dictionary.

Code:

```
server_owners_dict=dict()

    for i in data['resources']:
            if 'id' in i and 'name' in i:
                b = i['name'], i['id']
                k = str(b)
                if  re.findall("'Server-Ownership-\w+', \w+", k):
                    matchedOwners = re.findall("'Server-Ownership-\w+', \w+", k)[0]
                    j = str(matchedOwners).strip().split() 
                    server_owners_dict[j[0].replace('Server-Ownership-','')]=j[1]

    with open(PATH, mode='w') as my_csv_file:
        employee_writer = csv.writer(my_csv_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
        employee_writer.writerow(['Server Name','Criticals'])
        for owner in server_owners_dict:
            url = server + "/api/3/asset_groups/" + str(server_owners_dict[owner]) + "/assets"
            response = requests.request("GET", url, headers=headers, verify=False, params = {owner:server_owners_dict[owner]})
            data = response.json()
            for i in data['resources']:
                url = server+ "/api/3/assets/" + str(i)
                response = requests.request("GET", url, headers=headers, verify=False)
                data = response.json()
                if data['vulnerabilities']['critical'] > 0:
                    d = (owner)

```

The output of d looks like this:

```
'Bob',
'Bob',
'Bob',
'Jeff',
'Jeff',
'Mary',

```

These are the 'owners' in my dictionary and I would like to count the times they occur in this output and then return something like this:

```
Bob: 3
Jeff: 2
Mary: 1

```

I tried setting "owners=[]" before my for loop and then doing "owner +=1"
after the if statement at the bottom, but it kept saying it is not iterable.