Comment detail

2進数の記述 (Nested Flatten)
リテラルとしての2進数表現は現在ありませんが、以下のように書く事ができます。
(Python3.0では二進数表記も使えます)
1
2
3
4
5
6
i = int('01101001', 2) # 105

# 0,1以外はエラー
i = int('11111112', 2) # ValueError: invalid literal for int() with base 2: '1112'

i = 0b01101001 # python3.0

Index

Feed

Other

Link

Pathtraq

loading...