Base 2 to long integers and back
salnikov at inp.nsk.su
Wed Mar 21 10:03:20 CET 2001
For string->int or long the standard library does everything (in Python 2+):
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> s = '01010101010111100010'
"Tim CHURCHES" <TCHUR at doh.health.nsw.gov.au> wrote in message
news:mailman.985145066.15092.python-list at python.org...
> Can anyone suggest a fast method of converting base2 strings
> (e.g. '0000101110') to Python long integers, and back?
> I couldn't locate any functions in the standard library to do this,
> but no doubt I am overlooking something obvious.
> Tim Churches
> Sydney, Australia
More information about the Python-list