feat: upload

This commit is contained in:
MarkusJoe
2022-02-03 20:02:38 +08:00
commit e5945e8852
32 files changed
+365

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2022/2/3
# @File Name: base2img.py
import base64
def convert() -> None:
"""
:return:
"""
# image转base64
lst = []
for i in range(10):
with open(f'../../static/number/{i}.png', 'rb') as f:
base64_data = base64.b64encode(f.read())
base64_code = 'data:image/jpeg;base64,' + base64_data.decode('utf-8')
lst.append(base64_code)
print(lst)
for i in lst:
print(i)
convert()