티스토리 뷰

PL/Python

[Python] int 2진수로 바꾸기

SweetDev 2021. 7. 7. 16:02

# n진수 -> 10진수

print(int('101',2))

# 10진수 -> 2, 8, 16 진수

 

print(bin(11))
print(oct(11))
print(hex(11))

# 10진수 -> 2진수

arr = list(map(int, list(str(bin(B))[2:])))

 

[출처]

https://velog.io/@code_angler/파이썬-진수변환2진법-3진법-5진법-10진법n진법

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함