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()

    欢迎各位大虾指正
  • 相关阅读:
    wxpython自定义按钮
    wxPython修改文本框颜色
    strcat函数
    fopen作用
    Less 语法快速入门
    Echarts构建图表
    伪数组
    MVC,MVP,MVVM基本原理
    VUE常见指令
    Apply,Call,bind对比
  • 原文地址:https://www.cnblogs.com/he-zhi/p/8435863.html
Copyright © 2011-2022 走看看