>>> '{:+#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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to