Find anagrams with Python
#!/usr/bin/env python3
from collections import Counter
import sys,os
s=sys.argv[1]
def anagrams(word,words):
cw=Counter(word)
return [w for w in words if Counter(w)==cw]
base=os.path.dirname(os.path.abspath(__file__))
path=os.path.join(base,"words.txt")
with open(path) as f:
lines=f.read().splitlines()
print(anagrams(s,lines))
