creating dictionaries to list order of ranking

I have a list of people and who controls who but I need to combine them all and form several sentences to compute which person control a list of people.

The employee order comes from a txt file:


from collections import defaultdict

controls = defaultdict(list)

with open('data.txt') as file:
    for line in file:
        controller, controlled = line.strip().split(' controls ')

print 'employee order:'
for controller, controlled in controls.iteritems():       
    if len(controlled) > 1:
        conjoined = ', '.join(controlled[:-1])
        conjoined = '{} and {}'.format(conjoined, controlled[-1])
        conjoined = controlled[0]
    print '{} controls {}'.format(controller, conjoined)

Need Your Help

Can't set/find detect_unicode to Off

php mamp phpdoc composer-php

I'm want to start using phpDocumentor and the manual installation keeps throwing an error about me not having set detect_unicode = Off in my php.ini in Terminal.

How to assert a React component with multiple <a> tags has an <a> tag with a given href

reactjs mocha chai enzyme chai-enzyme

I'm trying to write a mocha test for a React component. Basically the component needs to render an &lt;a> tag with its href set to a value in a property that is passed in. The issue is that the com...