040-字符串與base64互轉

字符串與base64互轉

字符串與 base64 互轉示例:

import base64

str_ = "hello world"

# str 轉 base64
bs64_str = base64.b64encode(str_.encode())
print(bs64_str)
print()

# base64 轉 str
to_str = base64.b64decode(bs64_str)
print(to_str)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章