How to convert decimal to binary list in python

binary, list, python

Solution

You can probably use the builtin `bin` function:

bin(8) #'0b1000'

to get the list:

[int(x) for x in bin(8)[2:]]

Although it seems like there's probably a better way...

Problem

Possible Duplicate: Convert an integer to binary without using the built-in bin function how do I convert a decimal number into a binary list. For example, how do I change 8 into [1,0,0,0]

Original source

Related problems