I want to select a number from this list listand extract places from them from the nbits view .
I know that if I want 8 bits, I need to write
r = random.choice(list)
bin = "{0:08b}".format(r)
but i want to do something like
bin = "{0:0(self.n)b}".format(r)
where nis a member of the class.
How to do it?
source
share