This commit is contained in:
Debucquoy
2022-12-07 15:32:56 +01:00
parent ff6eeb2fad
commit d40e586226
13 changed files with 1264 additions and 0 deletions

39
01dec/compress.py Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/python
""" Compression
Usage:
compression.py (-c|-d) -t <type> --in <input> [--out <output>]
compression.py -h | --help
compression.py --version
Options:
-h --help Show this screen
--version Show Version
-c Compress
-d Decompress
-t Choose Compression Type
--in Input file
--out Output file
"""
def read_file(filename:str):
try:
with open(filename) as file:
return file.readall()
except e:
print(e)
def lz_compression(text:str):
"""compress all duplicate word
put each word into a list and make make a string of all the occurence
:text: string to compress
:returns: tuple with (list of word, decoding string)
"""
splitted_text = text.split()
if __name__ == "__main__":
from docopt import docopt
argument = docopt(__doc__, version="V1")