captcha.py
346 Bytes
'''
生成验证码图片
'''
from PIL import Image, ImageDraw, ImageFont, ImageFilter
import random
# 随机字符
def rndChar():
num = 0
while num == 0 and ((num >= 58 and num <= 64) or (num >= 91 and num <= 96)):
num = random.randint(48, 122)
return num
# 随机颜色
def rndColor():
return ''