Skip to content

Instantly share code, notes, and snippets.

@yarjor
Created April 1, 2018 18:15
Show Gist options
  • Select an option

  • Save yarjor/9d01defbec6842a26a97aeee320fddb8 to your computer and use it in GitHub Desktop.

Select an option

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.
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