zoukankan      html  css  js  c++  java
  • python 简单粗暴的生产的验证码

    import os
    import pygame
    import random

    from pygame.locals import *

    count = 0;

    生成验证码的函姝

    def get_code():

    count 绑定全局引用

    global count
    pygame.init()
    target = 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Za b c d e f g h i j k l m n o p q r s t u v w x y z'
    target = target.replace(' ', '')
    rlist = list(target)

    print( rlist );

    text = rlist[random.randint(0,25)] + rlist[random.randint(0,25)] + rlist[random.randint(0,25)] + rlist[random.randint(0,25)]

    print(text)

    font = pygame.font.SysFont('Microsoft YaHei', 64)

    ftext = font.render(text, True, (65, 83, 130),(255, 255, 255))

    控制图片生产的数量

    count = count + 1
    pygame.image.save(ftext, "D:/code/%d.jpg"%(random.randint(0,100000)))

    while count < 10000:
    get_code()

    欢迎各位大虾指正
  • 相关阅读:
    第三章,DNA序列的进化演变
    哈迪-温伯格定律和近亲杂交
    mysql
    Dajngo admin使用
    Django之Form组件
    python三大器
    python函数
    python文件操作
    python字典和集合
    算法基础
  • 原文地址:https://www.cnblogs.com/he-zhi/p/8435863.html
Copyright © 2011-2022 走看看