본문 바로가기

study/python

10진수, 8진수, 16진수

10진수를 8진수, 16진수로 출력하기

'%x'%n

 

print('%X%n) 대문자 형태 문자열로 출력

 

%x 16진수(hexadecimal)

%o 8진수(octal)

 

16진수를 10진수로 ㅂ

a = input()

n = int(a,16)

 

'study > python' 카테고리의 다른 글

비프시프트연산  (0) 2023.01.28
input 대신 sys.stdin.readline  (0) 2023.01.20
입력이 끝날 때까지 받는 End Of File과 sys  (0) 2023.01.15
오류 처리를 위한 try-except문  (0) 2023.01.15
입력과 출력 그리고 map에 대해  (0) 2023.01.15