cours_progra/01dec/compress.py
Debucquoy d40e586226
/
2022-12-07 15:32:56 +01:00

40 lines
903 B
Python
Executable File

#!/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")