Base64 인코딩 또는 디코딩 결과:
복사
Base64로 문자열 인코딩하기:
import base64
# 원본 문자열
original_string = "@https://base64.golong.uk/"
# 문자열 인코딩
encoded_bytes = base64.b64encode(original_string.encode("utf-8"))
encoded_string = encoded_bytes.decode("utf-8")
print(encoded_string)
Base64 디코딩은 인코딩의 역과정으로, Base64로 인코딩된 문자열을 원래의 이진 형태로 변환합니다.
Python 디코딩 예제:
Base64 문자열 디코딩하기:
import base64
# Base64로 인코딩된 문자열
encoded_string = "QGh0dHBzOi8vYmFzZTY0LmdvbG9uZy51ay8="
# 문자열 디코딩
decoded_bytes = base64.b64decode(encoded_string)
decoded_string = decoded_bytes.decode("utf-8")
print(decoded_string)