Получите ценность бита в целочисленном Python
def is_set(x, n):
return x & 1 << n != 0
# 10 in binary is 1010, and since 0 indexed the 1st bit is 1 therefore returns True
is_set(10, 1)
# >>> True
Anxious Alligator