03 2020 档案
摘要:1. 2.
阅读全文
摘要:方法一:定义一个函数,参数为所要生成随机字符串的长度。通过random.randint(a, b)方法得到随机数字,具体函数如下: def generate_random_str(randomlength=16): """ 生成一个指定长度的随机字符串 """ random_str = '' bas
阅读全文
摘要:要验证一个字符串是否为邮箱的话,首先要了解邮箱账号的格式。我尝试过在网上找出一个标准的格式,但是很遗憾我没有找到。我也尝试使用RFC标准来判断邮箱的格式,但是也没有结果。网上些博客说不应该使用RFC标准来验证邮箱是否合法,有兴趣的可以看看“is this email valid?”和“Don’t R
阅读全文
摘要:参考文章:https://blog.csdn.net/bqw18744018044/article/details/81171220 第一种是用urllib模块,下面是例示代码: 复制代码代码如下: import urllib status=urllib.urlopen("//www.jb51.ne
阅读全文
摘要:源代码: #!usr/bin/python3 # -*- coding:utf-8 -*- # @Time: 2018/12/17 下午2:07 # @File: do_excel.py # @Software: PyCharm import unittest from api_auto.commo
阅读全文
摘要:import randomdef generate_mobile(): """随机生成一个手机号码。。1[3,5,8,]+9""" phone = '1'+random.choice(["3","5","8"]) for i in range(9): num = random.randint(1,9
阅读全文
摘要:import random import string # 随机生成6到20位包含大小写字母加数字的用户名 def Creat_usernamePwd(): i = random.randint(6,20) username = ''.join(random.sample(string.ascii_
阅读全文
摘要:# 答疑 有人会问是什么原因导致了 这个问题,按正常理解来说在IDE里面能运行,在命令窗口里也照样能运行,都是执行的同一份文件? 这是因为Python在启动解释器(Interpreter)的时候不只会导入环境变量中sys.path发现的模块,还会导入当前工作目录下的模块。当你在IDLE中启动解释器时
阅读全文