Unhashable type list python -
When I run my program (Angram Solver) I get an error Unhashable type: list, thats Turning to Tupal but I still get the error.
There is a bunch of words in word.txt, such as word.txt
sudden fluctuation belly abscam
code here (Main): lenWord = 4 wordList = readMatrix () Length Word (lenWord) Def readMatrix (): wordList = [] strFile = open ("words.txt", " R ") lines = strfile.readlines () for line in line: word = line Rstrip () Short () wordList.append (word) return tuple (wordList) def length word (lenWord): wordList = readMatrix for word in word: if LAN (word) == Lane word: sortword = sorted (word) set Word = Set (word) SortDict = ({Sortword: Set Word}) Return sort main ()
You can roll back the list to a string ( str
)
sortWord = ''. Include (sorted (word))
Other suitable options can be Tupal
or frozenset
This next line is a bug, though - it's just a set of characters
setWord = set
Want to create a set?
For example.
Comments
Post a Comment