integer to binary 0-padded
jmfauth
wxjmfauth at gmail.com
Sat Jun 18 02:14:09 EDT 2011
More information about the Python-list mailing list
Sat Jun 18 02:14:09 EDT 2011
- Previous message (by thread): integer to binary 0-padded
- Next message (by thread): integer to binary 0-padded
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>> '{:+#0{}b}'.format(255, 1 + 2 + 16)
+0b0000000011111111
>>> '{:+#0{}b}'.format(-255, 1 + 2 + 16)
-0b0000000011111111
>>>
>>> eval('{:+#0{}b}'.format(255, 1 + 2 + 16))
255
>>> eval('{:+#0{}b}'.format(-255, 1 + 2 + 16))
-255
>>>
jmf
- Previous message (by thread): integer to binary 0-padded
- Next message (by thread): integer to binary 0-padded
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list