Created
April 1, 2018 18:15
-
-
Save yarjor/9d01defbec6842a26a97aeee320fddb8 to your computer and use it in GitHub Desktop.
[Block Division] Divide text to blocks of chosen size, and access wanted block without prior division.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def divide_blocks(string, block_length): | |
| return [string[i:i+block_length] for i in xrange(0, len(string), block_length)] | |
| def get_block(msg, length, index=0): | |
| return msg[length * index : length * (index + 1)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment