Re: integer to binary 0-padded

2011-06-15 Thread Olivier LEMAIRE
You're right, I use Python 2.6.6 -- http://mail.python.org/mailman/listinfo/python-list

Re: integer to binary 0-padded

2011-06-15 Thread Olivier LEMAIRE
Thank you to all of you !! so finally, I can simply write : #!/usr/bin/env python def int2binPadded(number, size): """The purpose of this function is to convert integer number to binary number 0-padded.""" if type(number)!=int or number < 0: raise ValueError, "should be a

integer to binary 0-padded

2011-06-15 Thread Olivier LEMAIRE
Hi there, I've been looking for 2 days for a way to convert integer to binary number 0-padded, nothing... I need to get numbers converted with a defined number of bits. For example on 8 bits 2 = 0010 I wrote the following: #!/usr/bin/env python def int2binPadded(number, size): """The