图片到base64编码的代码

This commit is contained in:
MarkusJoe
2022-02-12 11:29:54 +08:00
parent dc680a2eeb
commit 51edbbaf70
1 file changed
+6 -1
+6 -1
View File
@@ -3,4 +3,9 @@
# @Author: markushammered@gmail.com # @Author: markushammered@gmail.com
# @Development Tool: PyCharm # @Development Tool: PyCharm
# @Create Time: 2022/2/12 # @Create Time: 2022/2/12
# @File Name: img2base64.py # @File Name: img2base64.py
import base64
print(base64.b64encode(open('example.png', 'rb').read()).decode('utf-8'))