Guest User

Untitled

a guest
Nov 21st, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. # LZW sinifinin devami
  2. @staticmethod
  3. def decode(encoded, lzw_dict):
  4. res = ""
  5. reverse_lzw_dict = {}
  6. for k,v in lzw_dict.items():
  7. reverse_lzw_dict[v] = k
  8.  
  9. for e in encoded:
  10. res+=reverse_lzw_dict[e]
  11. return res
  12.  
  13. raw_str = "lzlzlzlw"
  14. res,ld = LZW.encode(raw_str)
  15. str1_a = LZW.decode(res,ld)
  16. print str1_a
  17. # Cikti: lzlzlzlw
Add Comment
Please, Sign In to add comment