随笔分类 -  python

摘要:import datetime i=0 while True: ret = (datetime.datetime.now() +datetime.timedelta(days=-30)+datetime.timedelta(minutes=+i)).strftime('%Y-%m-%d %H:%M: 阅读全文
posted @ 2022-05-27 22:22 test_yu 阅读(27) 评论(0) 推荐(0) 编辑
摘要:import random #生成随机数,浮点类型控制随机数的精度round(数值,精度) float = round(random.uniform(1, 100), 2) # 取0-100之间的数值精确到小数点后两位 print (float) 阅读全文
posted @ 2022-05-27 22:18 test_yu 阅读(708) 评论(0) 推荐(0) 编辑
摘要:# -*- coding:utf-8 -*- - import os, time last_worktime=0 last_idletime=0 def get_cpu(): global last_worktime, last_idletime f=open("/proc/stat","r") l 阅读全文
posted @ 2021-12-16 15:42 test_yu 阅读(64) 评论(0) 推荐(0) 编辑
摘要:#pip install psutil import psutil import os,datetime,time def getMemCpu(): data = psutil.virtual_memory() total = data.total #总内存,单位为byte free = data. 阅读全文
posted @ 2021-12-16 15:40 test_yu 阅读(146) 评论(0) 推荐(0) 编辑
摘要:【导读】:开发项目的时,为了测试常需要造假数据,经常要尽量的模拟真实环境,通常要费大量手工而且造出来的数据,而且通常手工造出来的看起来也很别扭,费时又费事,有没有更好的办法?有,这里给大家介绍一个“专业造数“库Faker,满足你对模拟数据的所有需求。 项目开发初期,为了测试方便,我们总要造不少假数据 阅读全文
posted @ 2021-06-15 13:55 test_yu 阅读(269) 评论(0) 推荐(1) 编辑
摘要:自己构建代理池,从各种代理服务网站中获取代理 IP,并检测其可用性(使用一个稳定的网址来检测,最好是自己将要爬取的网站),再保存到数据库中,需要使用的时候再调用 代码地址:链接:https://pan.baidu.com/s/19qFHwYHYR6SLXCMAxry9pQ 提取码:gxeb 1.获取 阅读全文
posted @ 2021-06-11 15:58 test_yu 阅读(2151) 评论(1) 推荐(0) 编辑
摘要:此教程为 第三方插件 激活方式 本教程适用于 Pycharm 所有版本 Windows、Mac、Linux系统都适用 一、激活前注意事项 软件一定要是在官网下载:https://www.jetbrains.com/ 本教程适用于jetbrains全系列产品(Pycharm、Idea、WebStorm 阅读全文
posted @ 2021-06-07 18:32 test_yu 阅读(995) 评论(0) 推荐(0) 编辑
摘要:#!/usr/bin/python3 # coding=utf-8 import logging import os.path import time class Logger(object): def __init__(self, logger): """指定保存日志的文件路径,日志级别,以及调用 阅读全文
posted @ 2021-06-07 17:27 test_yu 阅读(112) 评论(0) 推荐(0) 编辑
摘要:rows = driver.find_elements_by_css_selector('div.wrapper>ul.list>li') logger.info(len(rows)) 阅读全文
posted @ 2021-06-07 13:45 test_yu 阅读(1113) 评论(0) 推荐(0) 编辑
摘要:@staticmethod def unzip_file(failed_file): zip_file = zipfile.ZipFile(failed_file) print(zip_file) if os.path.isdir(failed_file[0:-20]): pass else: os 阅读全文
posted @ 2021-06-07 13:42 test_yu 阅读(109) 评论(0) 推荐(0) 编辑
摘要:for link in driver.find_elements_by_css_selector("tr:nth-child(1) > td.taskStatus use"): assert_status = link.get_attribute('xlink:href') print(assert 阅读全文
posted @ 2021-06-07 13:39 test_yu 阅读(338) 评论(0) 推荐(0) 编辑
摘要:1.准备安装工具 yum groupinstall "Development tools" yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-develtk-devel gdbm- 阅读全文
posted @ 2021-06-04 10:34 test_yu 阅读(203) 评论(0) 推荐(0) 编辑
摘要:安装python3.6.5,原来的python2.7.5并存 准备环境: 登录你的linux虚拟机或者云服务器,进入命令行界面如下图: 进入这样的窗口就是远程登录成功,我这里使用的是远程连接工具xshell,可以使用别的远程连接工具,比如CRT 检测你的环境中是否有python,查看版本 默认带的有 阅读全文
posted @ 2021-06-04 10:17 test_yu 阅读(125) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示