Skip to content

A simple mechanism to compress sequences with an index

License

Notifications You must be signed in to change notification settings

MuckRock/listcrunch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ListCrunch

A simple human-readable way to compress redundant sequential data.

Example

from listcrunch import crunch

compressed_string = crunch([1, 1, 1, 1, 1, 1, 1, 1, 1, 2])
# Returns '1:0-8;2:9', meaning 1 appears in indices 0-8 (inclusive),
# and 2 occurs at index 9.

To uncompress, use the uncrunch function.

from listcrunch import uncrunch

uncrunch('50:0-1,3-4;3:2,5;60:6;70:7-8')
# Returns ['50', '50', '3', '50', '50', '3', '60', '70', '70']

About

A simple mechanism to compress sequences with an index

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages