Popular recipes tagged "packetize"http://code.activestate.com/recipes/tags/packetize/2011-09-30T05:34:57-07:00ActiveState Code RecipesPython Easily Packetize / Slice / Chunk Text (Python)
2011-09-30T05:34:57-07:00__nerohttp://code.activestate.com/recipes/users/4177968/http://code.activestate.com/recipes/577885-python-easily-packetize-slice-chunk-text/
<p style="color: grey">
Python
recipe 577885
by <a href="/recipes/users/4177968/">__nero</a>
(<a href="/recipes/tags/chunk/">chunk</a>, <a href="/recipes/tags/packetize/">packetize</a>, <a href="/recipes/tags/regex/">regex</a>, <a href="/recipes/tags/split/">split</a>, <a href="/recipes/tags/udp/">udp</a>).
</p>
<p>I needed to chunk up some text to send over UDP and didn't want to have messy for loops with an if condition for size and then the little bit left over. All that struck me as very messy. I then thought of the re module and came up with a very simple solution to chunk up data.</p>