Revision: 69806
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 10, 2015 21:06 by rishi_devan
Initial Code
string = "thisisthe"
dictionary = {chr(i):i for i in range(97,123)}
last = 256
p = ""
result = []
for c in string:
pc = p+c
if pc in dictionary:
p = pc
else:
result.append(dictionary[p])
dictionary[pc] = last
last += 1
p = c
if p != '':
result.append(dictionary[p])
print(result)
Initial URL
Initial Description
Lempel Ziv Welch Compression Algorithm in python
Initial Title
LZW Compression
Initial Tags
Initial Language
Python