python生成随机验证码(中文验证码)示例
复制代码 代码如下:# -*- coding: utf-8 -*-import Image,ImageDraw,ImageFontimport randomimport math, string class RandomChar(): “””用于随机生成汉字””” @staticmethod def Unicode(): val = random.randint(0x4E00, 0x9FBF) return unichr(val) @staticmethod def GB2312(): head = random.randint(0xB0, 0xCF)