代码如下:
# -*- 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) body = random.randint(0xa, 0xf) tail = random.randint(0, 0xf) val = ( head