首页
新闻
博问
专区
闪存
班级
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
Aliwall
博客园
首页
新随笔
联系
管理
订阅
上一页
1
2
3
4
下一页
2021年5月29日
Python 使用 xlrd 读取.xlsx结尾的Excel文件报错 xlrd.biffh.XLRDError: Excel xlsx file; not supported
摘要: Python 使用 xlrd 读取.xlsx Excel文件报错 raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')xlrd.biffh.XLRDError: Excel xlsx file; not su
阅读全文
posted @ 2021-05-29 10:45 Aliwall
阅读(717)
评论(0)
推荐(0)
编辑
2021年5月28日
PyCharm 执行unittest不生成测试结果问题解决
摘要: PyCharm会默认使用自带的unittest框架来执行单元测试,不会执行main函数中的代码 解决方法: 1、点击PyCharm右上角的 Uittest in xxx.py下拉框. 2、点击Edit Configuration...,在弹出的对话框中,删除 unittests in xxxx.py
阅读全文
posted @ 2021-05-28 15:54 Aliwall
阅读(159)
评论(0)
推荐(0)
编辑
2021年5月17日
unittest 用例间数据共享参数传递.
摘要: 1 import unittest 2 import requests 3 import urllib3 4 urllib3.disable_warnings() 5 import warnings # 解决错误 ResourceWarning: Enable tracemalloc to get
阅读全文
posted @ 2021-05-17 16:47 Aliwall
阅读(254)
评论(0)
推荐(0)
编辑
格式化输出
摘要: a = "1" b_name = "小牛牛" # 用 %s 代替一个参数 s 是字符串str的意思. print("my name is %s" %b_name) print("my name is %s and my age is %s years old." % (b_name, a)) # m
阅读全文
posted @ 2021-05-17 16:41 Aliwall
阅读(14)
评论(0)
推荐(0)
编辑
字典传参
摘要: # 字典传参 token = 'ajkdakkfweids' name = "Jack" body = { 'aaa': '123', 'bbb': '567', 'token': token, #直接用变量代替参数, 注意参数是不需要引号的 'user': 'userid%s' %name # 参
阅读全文
posted @ 2021-05-17 16:40 Aliwall
阅读(86)
评论(0)
推荐(0)
编辑
正则表达式
摘要: 1 # 正则表达式 3 import re 5 a = "https://www.cnblogs.com/levia/p/14629386.html" 7 # 1 知道前后取中间. 取 14629386 8 htmlid = re.findall("/p/(.+?).html", a) 9 prin
阅读全文
posted @ 2021-05-17 16:35 Aliwall
阅读(30)
评论(0)
推荐(0)
编辑
python 文件混合读写模式 mode='r+'
摘要: # 常用 混合模式 mode r+ 读写混合模式. # 默认起始坐标为0,直接写入会覆盖原文件的内容. # 使用 f.seek(0,2) 把光标移到最后再进行写入操作. # f.read()读操作后光标会移到最后. # f.seek(0) # 0 代表从开文件头开始算起. seek(5,0)开头第5
阅读全文
posted @ 2021-05-17 16:33 Aliwall
阅读(294)
评论(0)
推荐(0)
编辑
2021年5月14日
unittest requests InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised.
摘要: unittest requests 在添加了以下代码依然出现以下错误: 1 import urllib3 2 urllib3.disable_warnings() InsecureRequestWarning: Unverified HTTPS request is being made. Addi
阅读全文
posted @ 2021-05-14 22:23 Aliwall
阅读(114)
评论(0)
推荐(0)
编辑
unittest requests 错误 ResourceWarning: Enable tracemalloc to get the object allocation traceback
摘要: unittest 使用 requests 发请求 遇到如下错误: ResourceWarning: Enable tracemalloc to get the object allocation traceback代码中添加以下红色代码即可. 1 import warnings 2 3 def se
阅读全文
posted @ 2021-05-14 22:14 Aliwall
阅读(1701)
评论(0)
推荐(0)
编辑
使用 requests_html 批量下载图片
摘要: # 自学, 不足之处还请大佬不吝指导,在此谢过. from requests_html import HTMLSession from lxml import etree import re import urllib3 urllib3.disable_warnings() url = "https
阅读全文
posted @ 2021-05-14 15:48 Aliwall
阅读(224)
评论(0)
推荐(0)
编辑
上一页
1
2
3
4
下一页