**Decompression Function: load a file bin from compression function **
def lzwDecompressionText () :
loadCompressed = open ("CompreText.bin","rb")
compressed = pickle.load(loadCompressed)
print("", compressed)
dictionary =defaultdict(dict)
lenDictionary = 256
decompressed_data = ""
string=""
for i in range(256):
dictionary[i] = chr(i)
Traceback (most recent call last):
File "c:/Users/anton/Documents/GitHub/Project-LZW/LZW-Project/test.py", line 21, in <module>
lzwDecompressionText()
File "c:\Users\anton\Documents\GitHub\Project-LZW\LZW-Project\textLzw.py", line 70, in lzwDecompressionText
if not (code in dictionary):
TypeError: unhashable type: 'dict'
for code in compressed:
if not (code in dictionary):
dictionary[code] = string + (string[0])
decompressed_data += dictionary[code]
if not(len(string) == 0):
dictionary[lenDictionary] = string + (dictionary[code][0])
lenDictionary += 1
string = dictionary[code]