words = [line.strip() for line in open('/usr/share/dict/words') if line.strip()] print([w for w in words if w.count('i') >= 6])