一、生成图片

1.1、说明
通过pillow模板库生成图片,步骤如下
- 安装pillow模板
- 建立 生成验证码内容 方法
- 建立 生成验证码颜色 方法
- 建立 生成验证码 方法
1.2、需要安装 Pillow 库
pip install Pillow==9.3.0
1.3、生成验证码内容
import random
def random_str(length=4):
""" 随机字符串 默认长度 4
:param length: 默认长度 4
:return:
"""
return ''.join(random.sample(string.ascii_letters, length))
1.4、生成验证码颜色
import random
# 生成颜色
def random_color():
# RGB
return random.randint(0,255),random.randint(0,255),random.randint(0,255)
<




![[沉淀之华] 自研基于SpringBoot Mybaits 构建低代码数据治理脚手架分享:涵盖数据同步、数据比对、数据归档、数据恢复为一体](https://img-blog.csdnimg.cn/direct/1e579858424441d69eae59ceb64adfd3.png)






![[CTF]-Web:部分题目WP](https://img-blog.csdnimg.cn/direct/122dbaa58fd34044bb17fc5b5d4a7ec5.png)




![[蓝桥杯练习题]确定字符串是否包含唯一字符/确定字符串是否是另一个的排列](https://img-blog.csdnimg.cn/direct/03007ca25d4e46a28e136723e476fa20.png)


