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

    欢迎各位大虾指正
  • 相关阅读:
    文件操作
    苹果越狱
    猫的期幻之旅-20130114
    js传url中文参数乱码问题
    JS三元
    SQL同列合并
    数据库引擎介绍innodb和myisam
    数据库优化
    gleez 下分页功能优化
    kohana安装总结
  • 原文地址:https://www.cnblogs.com/he-zhi/p/8435863.html
Copyright © 2011-2022 走看看