Last active
November 25, 2020 10:40
-
-
Save miku/c1220715060babc2374a440bd742a410 to your computer and use it in GitHub Desktop.
combinations for the command line
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
#!/usr/bin/env python | |
import fileinput | |
import itertools | |
vs = set() | |
for line in fileinput.input(): | |
line = line.strip() | |
if not line: | |
continue | |
vs.add(line) | |
for a, b in itertools.combinations(sorted(vs), r=2): | |
print("{}\t{}".format(a, b)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment