Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
2 answers
207 views

Checking file header for magic number in Python

I wrote this to check files for successful compression with LZ4. Any advice is welcome. Particularly regarding raising exceptions and error handling. ...
voices's user avatar
  • 767
4 votes
1 answer
379 views

Huffman encoding as Unix style command line utility

After watching Tom Scott explain Huffman coding in this YouTube video, I wanted to implement it myself. I want to use this project to further my understanding of Python. Additionally this tool should ...
endofline's user avatar
  • 143
6 votes
2 answers
336 views

Compressing large jpeg images

I'm working with thousands of large image files in a regularly updated library. The following script does the job (on average reduces my file size ~95%) but costs me around 25 seconds to compress one ...
cburchie's user avatar
3 votes
1 answer
96 views

File compressor

I have written a file compressor in python. The program generates a file filled with sequences of the same character with a random length, and compresses that file. I would like feedback on code ...
Ben A's user avatar
  • 10.8k
4 votes
1 answer
123 views

Google drive backup robot

I have a lot of files. I care about those files. I also care about good programming practices and learning proper Python. Given the described context, it seemed appropriate to implement my own ...
sage's user avatar
  • 337
2 votes
2 answers
2k views

Reading a gzipped file with JSON data for thousands of users

I'm a newbie in Python. I need to read a GZ file contains thousands of users. But I think my code is not optimized in this case. Could anyone can help me? What should I do to improve performance? Or ...
Han Van Pham's user avatar
2 votes
1 answer
8k views

Read gzipped JSON file from URL

I am requesting a JSON file that's gzipped. First, I download file: ...
Han Van Pham's user avatar
7 votes
1 answer
1k views

Python 3.x Hexdump

I posted a small hexdump generator function from a program I've been writing not long ago and applied what a reviewer suggested since then. The goal was to lazily hexdump bytes objects (byte strings, ...
user avatar
3 votes
1 answer
5k views

Compress and decompress a string from a file

I need to compress some text, I'm wondering if my program could be made more efficient. The only things I could think of would be the 'import re' and turning the filename input and read part as a ...
user avatar
3 votes
2 answers
10k views

Simple string compression in Python

This is my solution to exercise 1.6 in Cracking the Coding Interview. I am interested in receiving feedback on the coding style and time/space complexity. The exercise statement is: Implement a ...
Average's user avatar
  • 851
6 votes
1 answer
405 views

Prefix free compression and decompression

I have written a prefix-free compressor that assigns the shortest bit-strings to the most common characters. It works very well for natural language as some characters (SPACE, "a", "e" ...) are much ...
Caridorc's user avatar
  • 28.1k
19 votes
2 answers
35k views

Simple backup script in Python

Since rsync lacks compression and I'm not a big fan of rdiff, I thought I'd try my own little backup script. Since I'm very ...
magu_'s user avatar
  • 938