Popular recipes tagged "bytes" but not "string"http://code.activestate.com/recipes/tags/bytes-string/2013-11-03T18:35:18-08:00ActiveState Code RecipesDetermine bytes needed to hold integer (Python3) (Python) 2013-11-03T18:35:18-08:00teddy_khttp://code.activestate.com/recipes/users/4187115/http://code.activestate.com/recipes/578766-determine-bytes-needed-to-hold-integer-python3/ <p style="color: grey"> Python recipe 578766 by <a href="/recipes/users/4187115/">teddy_k</a> (<a href="/recipes/tags/bytes/">bytes</a>, <a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/integer/">integer</a>). </p> <p>Convenience function to determine the number of bytes needed for a specified integer (split into multiple lines for clarity's sake ... could just as easily be a one-liner).</p> <p>If this is already a defined function within Python, please let me know--a quick web search turned up nothing.</p> Humanized representation of a number of bytes (Python) 2010-03-05T17:18:13-08:00Doug Latornellhttp://code.activestate.com/recipes/users/4173209/http://code.activestate.com/recipes/577081-humanized-representation-of-a-number-of-bytes/ <p style="color: grey"> Python recipe 577081 by <a href="/recipes/users/4173209/">Doug Latornell</a> (<a href="/recipes/tags/bytes/">bytes</a>, <a href="/recipes/tags/humanize/">humanize</a>). Revision 2. </p> <p>Convert an integer number of bytes to a string representation. Example: 1024 -> 1 kB</p> <p>Based quite heavily on <a href="http://mail.python.org/pipermail/python-list/2008-August/1171178.html">http://mail.python.org/pipermail/python-list/2008-August/1171178.html</a></p> Bitset (Python) 2009-05-04T16:37:02-07:00geremy condrahttp://code.activestate.com/recipes/users/4170000/http://code.activestate.com/recipes/576738-bitset/ <p style="color: grey"> Python recipe 576738 by <a href="/recipes/users/4170000/">geremy condra</a> (<a href="/recipes/tags/bits/">bits</a>, <a href="/recipes/tags/bytes/">bytes</a>). </p> <p>This is a simple Bitset type for Python. It implements the Sequence interface plus __setitem__, the set operations, and string and integer conversions.</p>