Convert a sequence of bits to a bit-string

2007-12-15 Thread te509
Hi guys, does anybody know how to convert a long sequence of bits to a bit-string? I want to avoid this: >>> bit=00110101110111010001 >>> >>> str(bit) '949456129574336313917039111707606368434510426593532217946399871489' I would appreciate

Convert a sequence of bits to a bit-string

2007-12-15 Thread te509
Hi guys, does anybody know how to convert a long sequence of bits to a bit-string? I want to avoid this: >>> bit=00110101110111010001 >>> >>> str(bit) '949456129574336313917039111707606368434510426593532217946399871489' I would appreciate

Re: Convert a sequence of bits to a bit-string

2007-12-15 Thread te509
>> does anybody know how to convert a long >> sequence of bits to a bit-string? > >Yes! Would you like to help, please? >> I would appreciate a prompt reply because I have a python assessment to >> submit. > >Good luck, you're lucky you've got the whole weekend :) That's not the only assignment I

Re: Convert a sequence of bits to a bit-string

2007-12-15 Thread te509
First of all I'd like to thank you all for your advices. Before I check all your hints I want to clarify what I'm trying to do. The question says "write a function that takes a sequence of bits as an input and return how many 1s are in the sequence", nothing more. This is quite simple for string