python标准库:base64模块,,Base64是一种用
python标准库:base64模块,,Base64是一种用
Base64是一种用64个字符来表示任意二进制数据的方法。(将二进制编码转换成ASCII字符)。使用A-Z,a-z,0-9,/,+这64个字符。
函数 | 描述 |
base64.b64encode(s) | 对二进制数据进行base64编码 |
base64.b64decode(s) | 对base64编码的数据进行解码 |
base64.urlsafe_b64encode(s) | 对URL进行baase64编码 |
base64.urlsafe_b64decode(s) | 解码 |
import base64str1=b"hello word"encode_data=base64.b64encode(str1)print(encode_data)print(base64.b64decode(encode_data))>>>>b‘aGVsbG8gd29yZA==‘ b‘hello word‘
import base64url="https://www.google.com"encode_data=base64.urlsafe_b64encode(url.encode())print(encode_data)print(base64.urlsafe_b64decode(encode_data))>>>b‘aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbQ==‘ b‘https://www.google.com‘
python标准库:base64模块
相关内容
- python计算不规则图形面积算法,,介绍:大三上做一个医
- Python学习手册,,pycharm的安装
- python中字典,python访问字典,字典中key:不可改
- 不能错过!你必须知道的3种重要Python技能,错过你一切
- 使用python封装get+post请求,pythonpost,源代码: 1 fro
- python中的not的意思,python中的not,python中的no
- 8个用Python进行机器学习建模项目的实用建议,让新手小
- python3 pexpect模块,python模块,pexpectimp
- Python Ethical Hacking - VULNERABILITY SCANNER(8),Ethical,Implement
- Python更换镜像源,源镜像, 目录
评论关闭