I have an assignment where I have to apply the Lempel-Ziv Algorithm (Python). I have to read an input file build a program that compresses it and generates the compressed file, and then build another program that decompresses the compressed file back to the initial one. My code is working fine for most files, but not for all. My problem is in the way that I read and write the files.
I convert the input file in a binary string in order to manipulate it (compression). Then I have to store that string in an intermediate file. Then use the string in the intermediate file to manipulate it (decompression) and generate the final file.
To a specific file I got the error "\ No newline at end of file" when I test the differences between the original file and the decompressed one.
Here https://github.com/PedroAlexLeite/LZ you have access to the code and the file that is giving me this error.
Thanks in advance.