/
This commit is contained in:
39
01dec/compress.py
Executable file
39
01dec/compress.py
Executable 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")
|
||||
Reference in New Issue
Block a user