标签:计算机 ike 进制 bit int byte 表示 www blank
# 想将字符串转编码成base64,要先将字符串转换成二进制数据 url = "https://www.cnblogs.com/songzhixue/" bytes_url = url.encode("utf-8") str_url = base64.b64encode(bytes_url) # 被编码的参数必须是二进制数据 print(str_url) b‘aHR0cHM6Ly93d3cuY25ibG9ncy5jb20vc29uZ3poaXh1ZS8=‘
# 将base64解码成字符串 import base64 url = "aHR0cHM6Ly93d3cuY25ibG9ncy5jb20vc29uZ3poaXh1ZS8=" str_url = base64.b64decode(url).decode("utf-8") print(str_url) ‘https://www.cnblogs.com/songzhixue/‘
标签:计算机 ike 进制 bit int byte 表示 www blank
原文地址:https://www.cnblogs.com/youxiu123/p/11624363.html