随笔分类 -  Python-Basic

摘要:1、场景 从接口读取数据写入文件时,在文件中显示的是Unicode字符 2、处理方法 import json def read_json_file(file_path): try: with open(file_path, mode='r', encoding='utf-8') as fp: res 阅读全文
posted @ 2022-10-26 10:06 代码诠释的世界 阅读(1002) 评论(0) 推荐(0)
摘要:1、场景 自动化测试中,需要将一些接口自动的写入到yaml中, 但是发现文件中显示的是Unicode字符 2、处理方法 import yaml def load_yaml_data(file_path): try: with open(file_path, 'r', encoding='utf-8' 阅读全文
posted @ 2022-10-25 21:02 代码诠释的世界 阅读(350) 评论(0) 推荐(0)
摘要:1、问题 python调用grpc接口报错 2、原因 由于更新了代码,proto文件没有重新build生成 3、重新build方法 python -m grpc_tools.protoc --python_out=./tools/ --grpc_python_out=./tools/ -I. ./p 阅读全文
posted @ 2022-10-08 16:21 代码诠释的世界 阅读(30) 评论(0) 推荐(0)
摘要:1、pypi https://pypi.org/project/pyqtgraph/ 2、安装 pip install pyqtgraph 阅读全文
posted @ 2022-10-08 16:15 代码诠释的世界 阅读(528) 评论(0) 推荐(0)
摘要:1、问题 做接口测试自动化时,参数传递时,默认给的null,直接写None会被解析成字符串 2、出问题的格式 打印 “Total': 'None' 3、正确的解析成None的方法 方式一,后面留空 输出 方式二、写成 null 输出 方式三、写成 ~ 输出 参考链接: https://blog.cs 阅读全文
posted @ 2022-10-01 16:00 代码诠释的世界 阅读(360) 评论(0) 推荐(0)
摘要:1、问题 rpc接口在调用的时候报错 2、原因 这个报错的意思就是int转换时,转换的对象不能调用 本次错误,主要是因为int(obj.a) 写成了int(obj.a()), 导致属性获取失败 3、处理 修改int(obj.a())为int(obj.a) 即可 本质上int转换的对象也就是那字符串, 阅读全文
posted @ 2022-10-01 15:43 代码诠释的世界 阅读(478) 评论(0) 推荐(0)
摘要:1、打开要提前加注释的函数 2、双击选中函数名,右键 3、点击【show Context Actions】 4、点击【insert a documentation string sub】 5、然后添加函数说明和参数说明即可 阅读全文
posted @ 2022-08-24 20:05 代码诠释的世界 阅读(259) 评论(0) 推荐(0)
摘要:1、pypi https://pypi.org/project/psutil/ 2、github https://github.com/giampaolo/psutil 3、doc https://psutil.readthedocs.io/en/latest/ 4、获取chromedriver.e 阅读全文
posted @ 2022-08-24 16:30 代码诠释的世界 阅读(1492) 评论(0) 推荐(0)
摘要:1、环境 python3 OSX 12.5 vscode 2、安装ffmpeg brew install ffmpeg 3、安装cv2 pip install opencv-python # or pip --default-timeout=100 install opencv-python -i 阅读全文
posted @ 2022-08-24 14:43 代码诠释的世界 阅读(4642) 评论(0) 推荐(0)
摘要:参考链接: http://events.jianshu.io/p/2405999c7c88 阅读全文
posted @ 2022-08-24 14:13 代码诠释的世界 阅读(76) 评论(0) 推荐(0)
摘要:1、代码 # -*- coding:utf8 -*- import cv2 as cv cap = cv.VideoCapture(0) while (True): hx, frame = cap.read() if hx is False: print('read video error') ex 阅读全文
posted @ 2022-08-24 11:55 代码诠释的世界 阅读(376) 评论(0) 推荐(0)
摘要:1、使用os.popen 2、使用os.system 3、使用subprocess.Popen 参考链接: https://blog.csdn.net/weixin_43276033/article/details/125481262 https://blog.csdn.net/sirobot/ar 阅读全文
posted @ 2022-08-22 11:20 代码诠释的世界 阅读(36) 评论(0) 推荐(0)
摘要:1、使用国内的镜像地址 https://registry.npmmirror.com/binary.html?path=chromedriver/ 2、通过simulation模拟用户点击来下载(只贴出部分方法) #!/usr/bin/env python # -*- coding:utf-8 -* 阅读全文
posted @ 2022-08-19 20:49 代码诠释的世界 阅读(335) 评论(0) 推荐(0)
摘要:1、官网 https://pypi.org/project/requests-html/ 2、github https://github.com/kennethreitz/requests-html 3、安装 pip install requests-html 4、使用HTMLSession hea 阅读全文
posted @ 2022-08-19 14:03 代码诠释的世界 阅读(817) 评论(0) 推荐(0)
摘要:1、官网 https://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/ 2、安装 pip install BeautifulSoup4 pip install lxml pip install requests 3、解析脚本 import requests f 阅读全文
posted @ 2022-08-19 13:50 代码诠释的世界 阅读(200) 评论(0) 推荐(0)
摘要:1、pip install BeautifulSoup报错 Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting BeautifulSoup Using cached https://pypi.tuna.tsi 阅读全文
posted @ 2022-08-18 11:58 代码诠释的世界 阅读(847) 评论(0) 推荐(0)
摘要:1、官网 https://airtest.netease.com/ 2、项目地址 https://github.com/AirtestProject 3、官方文档 欢迎使用 - Airtest Project Docs 4、安装AirtestIDE 解压运行即可 5、设备唤醒 https://jue 阅读全文
posted @ 2022-08-12 15:21 代码诠释的世界 阅读(184) 评论(0) 推荐(0)
摘要:1、官网 https://httprunner.com/https://httprunner.com/docs/ 2、github https://github.com/httprunner/httprunner https://github.com/httprunner/QuickRunner 3 阅读全文
posted @ 2022-08-12 10:21 代码诠释的世界 阅读(309) 评论(0) 推荐(0)
摘要:1、阿里源 https://developer.aliyun.com/mirror/pypi 2、华为源 https://mirrors.huaweicloud.com/home 3、命令行配置 升级pip pip install -i https://pypi.tuna.tsinghua.edu. 阅读全文
posted @ 2022-08-10 10:58 代码诠释的世界 阅读(8685) 评论(0) 推荐(0)
摘要:参考链接: https://blog.csdn.net/qq_37107304/article/details/103731209 阅读全文
posted @ 2022-08-01 20:06 代码诠释的世界 阅读(115) 评论(0) 推荐(0)