ICode9

精准搜索请尝试: 精确搜索
  • 经常使用的一些公共方法2021-07-05 16:03:36

        #随机生成字符串 def random_str(self, num): str = '' chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789-_' length = len(chars) - 1 for i in range(num): str +=chars[ra

  • 使用-robot【使用外部库】【random】2021-06-29 10:04:05

    外部库random的使用 #错误 ${ran int}= Evaluate random.randint(0, sys.maxsize) # 正确 I'm surprised the randint() doesn't work for you - did you use the correct syntax, Evaluate must point/end with the external module you're using, "random&q

  • 使用-robot【使用外部库】【random】2021-06-29 10:04:05

    外部库random的使用 #错误 ${ran int}= Evaluate random.randint(0, sys.maxsize) # 正确 I'm surprised the randint() doesn't work for you - did you use the correct syntax, Evaluate must point/end with the external module you're using, "random&q

  • Python库——Faker——生成伪造数据的第三方库2021-06-25 19:04:32

    最近做一个项目时需要随机生成人的名字,百度之后,我是这样写的: def random_first_name(): """百家姓中选择一个""" name = ['赵', '钱', '孙', '李', '周', '吴', '郑', '王', '冯', &

  • Python-web开发验证码的制作2021-06-15 15:53:09

    一、安装依赖包Pillow pip install Pillow 二、验证码一般是放在一个项目的工具方法中 三、验证码的代码 #!/usr/bin/env python # encoding: utf-8 from random import randint,choice from PIL import Image,ImageDraw,ImageFont from cStringIO import StringIO from string

  • 计应191西仝宣婉2021-05-31 21:05:03

    创建小学生口算题目文件math.txtfobj = open('math.txt', 'w')defbase_exei_oneline(pmin, pmax, mmin, mmax, multimin, multimax, divmin, divmax):'''pmin,pmax:加数、被加数最小最大值mmin,mmax:减法转换成加法后,加数、被加数最小最大值multimin,multimax:乘数、被

  • 计应191西李明娇2021-05-31 21:01:21

    if __name__ == '__main__':    import random    for i in range(0,10):        s = ""        for i in range(0, 3):            type = random.randint(1, 4)            if type == 1:        

  • randint() , numpy.sum() , Pandas DataFrame.loc[], numpy.argpartition()2021-05-25 02:05:06

    some notes from coding practice, source from:  GeekforGeek     randint(): return a random integer by given the specific range [start, end],  edge included  1 # Python3 program explaining work 2 # of randint() function 3 4 # imports random module

  • 2021-05-242021-05-24 21:31:38

    一段turtle程序 import random A=0 B=0 C=0 D=0 E=0 F=0 gs=random.randint(4,6) aa=[] if gs==4:     for i in range(0,15):         D+=1         if D==2:             D=0             C=C+1         if C==2:             C=0      

  • 简易模拟点击自动化测试工具介绍2021-05-18 16:02:48

    简要框架设计图     目前简易框架目录    其中: cmd_deivces.py 是设备管理类,设备相关信息处理都放在此类中 cmd_command.py 是公共方法类,测试用例的相关处理都放在此类中 exc_testcases.py 是测试用例类,测试用例都放在此类中 现阶段主要快速适用于适配线项目而设计   exc_t

  • Python00001题:生成激活码2021-05-04 09:04:42

    题目:#做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券) import random a = [] for i in range(200): n = "" for m in range(15): num = random.randint(0,9) alf = chr(

  • python自动化2021/04/14 radom模块2021-04-15 11:05:26

    import random# #0-1的随机浮点数# print(random.random())## #1-3之间的浮点数# print(random.uniform(1,3))## #随机整数# print(random.randint(1,5))## #顾头不顾尾# print(random.randrange(1,5))## #从序列元素中随机选取一个# print(random.choice(["张三","李四","王五"])

  • 计应193第一组个人流程——康帅2021-04-11 19:32:21

      from fractions import Fraction def newint(): opr = ['+', '-', '×', '÷'] fh = random.randint(0, 3) n1 = random.randint(1, 20) n2 = random.randint(1, 20) rjg = 0 if fh == 0: rjg = n1

  • Python工具系列之验证码自动生成2021-04-07 17:01:49

    Python工具系列之验证码自动生成 小程序爬虫接单、app爬虫接单、网页爬虫接单、接口定制、网站开发、小程序开发> 点击这里联系我们 < 微信请扫描下方二维码 代码仅供学习交流,请勿用于非法用途 直接上代码 # -*- coding:utf-8 -*- import random import os from PIL impor

  • pillow模块2021-04-04 15:02:42

    Pillow模块 一、Pillow模块安装 在cmd指令框通过pip安装 pip install pillow 在pycharm中安装模块 二、操作图像 图片缩放 # 方法一 from PIL import Image img3=Image.open('002.jpg') w,h=img3.size img3.thumbnail((w//2,h//2))#w//2 取整,将图像的宽高缩小为1/2,thumb

  • 股票价格在随机漫步吗?用 Python 来告诉你2021-03-31 14:01:27

    什么是随机漫步在这个世界上存在的现象大体分为必然现象和随机现象两类。必然现象就像太阳每天必然从东边升起,西边落下那样,在相同条件下完全可以事先预测到它的结果。随机现象则不同,它在个别试验中会呈现不确定的结果,比如抛掷一次硬币,可能是正面,也可能是反面,不过在相同的条件下大量

  • Python-web验证码的实现2021-03-15 22:55:03

    此代码是需要依赖:sanic==19.9.0Pillow==7.0.0马哥教育Python网络班企业教练思路:import randomimport stringimport uuidimport base64import platformfrom PIL import Image, ImageDraw,ImageFontfrom io import BytesIOfrom sanic import Sanicfrom sanic.response import HTTPRes

  • python中random模块2021-02-24 09:33:58

      >>> import random >>> random.randint(1,10) ## 随机抽取1-10的数字 1 >>> random.randint(1,10) 4 >>> random.randint(1,10) 9 >>> random.randint(1,100) 67 >>> random.randint(1,100) 42 >>> random.rand

  • python构建简单的验证码2021-02-23 10:59:26

    此文为自己学习归纳总结: 看此文前提有一定的python经验,忘记此文是从哪里找到的。要是楼主看到勿喷。 导入相关依赖,执行以下代码即可 # 构建一个简单的验证码 import string import random from PIL import Image, ImageFont, ImageDraw, ImageFilter # 生成随机数字或字母 # n

  • k-means代码学习2021-02-21 09:59:00

    前言 学习模式识别第二次大作业 代码理解 一、内容 验证k-means 和fcm算法在iris和sonar数据集。 二、部分代码及理解 1. sklearn库自带的小的数据集引用格式为:sklearn.datasets.load_ from sklearn.datasets import load_iris sklearn提供的自带的数据集 2. start=time.ti

  • python之自动生成器(持续更新)2021-02-12 17:29:21

    1、小学生计算题自动生成器 源码: import random, os import PySimpleGUI as sg from docx import Document from docx.shared import RGBColor, Pt, Mm, Inches from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml.ns import qn ''' 该程序产生口算题doc文件: '

  • 2021美赛C题经验分享2021-02-06 22:59:53

    2021美赛C题经验分享 本科期间对数学建模一直挺感兴趣,自认为在建模方面表现不错,拿过国一、美一也算圆满。 虽然2021年美赛没有亲自参赛,btw作一名热心的学长(??)在家蹲的同时也不忘关注着这场烧脑大战。 美赛已经过半了,目前写了C题和F题,感觉还行吧… 这里也想给学弟学妹们分享下

  • 【python练习4】小学生计算能力测试系统2021-02-05 16:58:25

    设计一个程序,用来实现帮助小学生进行算术运算练习,它具有以下功能: 提供基本算术运算(加减乘),每道题中的操作数是随机产生的,练习者根据显示的题目输入自己的答案,程序自动判断输入的答案是否正确并显示相应的信息,最后显示正确率 from random import randint,choice#导入需要的

  • Python之random.randint()用法2021-02-05 00:01:37

    1. 函数功能 random.randint(参数1, 参数2) ● 参数1,参数2必须是整数 ● 函数返回参数1和参数2之间的任意整数 2. 示例 import random result = random.randint(1,10) print("result: ",result) 输出: result: 6

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有