Skip to content

Instantly share code, notes, and snippets.

@Dav1dde
Created June 9, 2012 11:27
Show Gist options
  • Save Dav1dde/2900625 to your computer and use it in GitHub Desktop.
Save Dav1dde/2900625 to your computer and use it in GitHub Desktop.
In [6]: a = bin(8)[2:] # 0b entfernen
In [7]: len(a)
Out[7]: 4
In [10]: '0' * (24-len(a)) + a
Out[10]: '000000000000000000001000'
In [11]: int(_, 2)
Out[11]: 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment