-
-
Save emberian/8e2c4f9037939dd86e654acf8b8d46d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from collections import defaultdict | |
hosts_by_pkg = defaultdict(set) | |
for line in sys.stdin: | |
line = line.strip() | |
if not line: | |
continue | |
host, pkg = line.split() | |
hosts_by_pkg[pkg].add(host) | |
for pkg, hosts in hosts_by_pkg.items(): | |
init = f'{pkg}: ' | |
print(init + ', '.join(hosts)) | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment