From the course: Python Essential Training
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Solution: Compressing ASCII art - Python Tutorial
From the course: Python Essential Training
Solution: Compressing ASCII art
- [Instructor] This is the final challenge of the course and not coincidentally, it's also the challenge that has the greatest number of possible solutions. You could do just about anything you wanted to do here and it would probably work. So let's go over three basic types of data compression you might have done here and if you didn't do any of these or a variation on them, awesome. The great thing about data compression is that as long as the data shrinks and then expands back to more or less the original, no one really cares how you got there, but I care. So if you do find something cool, let me know. So the first thing I did was take that JSON blob from encode string and then just write it to a file. And then with decode file, we can open that file name again, read the JSON blob, and then run it through decode string. So if I run this, so the file compression is not the greatest here, went down to 2,441 bytes, but technically we did reduce the file size. So hooray, file…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.