'''你是一个高级测试工程师,现在要做性能测试,需要你写一个函数,批量生成一些注册使用的账号. 1.产生的账号是以@163.com结尾,长度由用户输,产生多少条也由用户输入,2.用户名不能重复,用户名必须由大写字母.小写字母.数字组成,结果如下图: 1 import random,string 2 3 def users(count,legth): 4 with open('users.txt','w') as f: 5 for i in range(count): 6 str1 = ''.jo
最近生成训练数据时,给一批无效的背景图片生成对应的xml文档,我用python写了一个简单的批量生成xml文档的demo,遇见了意外的小问题,记录一下. 报错问题为:ImportError: No module named 'xml.dom'; 'xml' is not a package 看见No module named “xxx”时想的是不就是没安装xml包嘛,还不简单,install一下不就好了,然而并没什么用,xml是python本生就带的.其实出现这种错误的原因是自己的命名规则问题,
写在最前 平时在工作中尤其是在做压测的时候难免需要一些用户名和密码,写个简单的Python小脚本批量生成一些 代码示例 import random,string #生成大小字母和数字一起的大字符串 all_str=string.ascii_letters+string.digits res_lit=[] #生成100个 ): #从大字符串中随机生成8位数的字符,换行并转换成字符串 res = ))+'\n' if res not in res_lit: res_lit.append(res) f
1,首先写一条能运行成功插入SQL的语句 INSERT INTO sign_guest(realname,phone,email,sign,event_id)VALUES("jack",13800101100,"jack@mail.com",0,1) 2,通过python批量写如文本 f =open('guest.txt','w') for i in range(1,100): str_i = str(i) realname = 'jack' + str_i pho
#!/usr/bin/python # -*- coding=utf-8 -*- # author : Manuel # date: 2019-05-15 from xml.etree import ElementTree as ET import numpy as np from skimage import data,filters,segmentation,measure,morphology,color from scipy.misc import imread import os fr