05 2021 档案

摘要: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 阅读(882) 评论(0) 推荐(0)
摘要:PyCharm会默认使用自带的unittest框架来执行单元测试,不会执行main函数中的代码 解决方法: 1、点击PyCharm右上角的 Uittest in xxx.py下拉框. 2、点击Edit Configuration...,在弹出的对话框中,删除 unittests in xxxx.py 阅读全文
posted @ 2021-05-28 15:54 Aliwall 阅读(477) 评论(0) 推荐(0)
摘要: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 阅读(500) 评论(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 阅读(37) 评论(0) 推荐(0)
摘要:# 字典传参 token = 'ajkdakkfweids' name = "Jack" body = { 'aaa': '123', 'bbb': '567', 'token': token, #直接用变量代替参数, 注意参数是不需要引号的 'user': 'userid%s' %name # 参 阅读全文
posted @ 2021-05-17 16:40 Aliwall 阅读(161) 评论(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 阅读(62) 评论(0) 推荐(0)
摘要:# 常用 混合模式 mode r+ 读写混合模式. # 默认起始坐标为0,直接写入会覆盖原文件的内容. # 使用 f.seek(0,2) 把光标移到最后再进行写入操作. # f.read()读操作后光标会移到最后. # f.seek(0) # 0 代表从开文件头开始算起. seek(5,0)开头第5 阅读全文
posted @ 2021-05-17 16:33 Aliwall 阅读(699) 评论(0) 推荐(0)
摘要:unittest requests 在添加了以下代码依然出现以下错误: 1 import urllib3 2 urllib3.disable_warnings() InsecureRequestWarning: Unverified HTTPS request is being made. Addi 阅读全文
posted @ 2021-05-14 22:23 Aliwall 阅读(335) 评论(0) 推荐(0)
摘要: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 阅读(2182) 评论(0) 推荐(0)
摘要:# 自学, 不足之处还请大佬不吝指导,在此谢过. 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 阅读(429) 评论(0) 推荐(0)
摘要:使用 python requests 遇到以下错误: ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif 阅读全文
posted @ 2021-05-14 12:05 Aliwall 阅读(1089) 评论(0) 推荐(0)