上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页
  2023年8月3日
摘要: 当在子线程中调用pyppeteer工具的时候,会报错:ValueError: signal only works in main thread。 解决方案: 在创建浏览器对象时,加上以下三个字段: 阅读全文
posted @ 2023-08-03 17:33 CJTARRR 阅读(321) 评论(0) 推荐(0) 编辑
  2023年7月30日
摘要: class A: def cost(self): print('cost a')​​class B: def cost(self): print('cost b')​​class MyAdapter:​ def __init__(self, obj): self.obj = obj​ def pay 阅读全文
posted @ 2023-07-30 13:01 CJTARRR 阅读(5) 评论(0) 推荐(0) 编辑
摘要: class Singleton(object):​ def __new__(cls, *args, **kwargs): if not hasattr(cls, '_instance'): cls._instance = super(Singleton, cls).__new__(cls) retu 阅读全文
posted @ 2023-07-30 10:39 CJTARRR 阅读(4) 评论(0) 推荐(0) 编辑
  2023年7月25日
摘要: db.col.createIndex({"title":1}) 创建索引db.col.getIndexes() 查询当前索引db.col.totalIndexSize() 查询索引大小db.col.dropIndexes() 删除所有索引db.col.dropIndex("索引名称") 删除指定索引 阅读全文
posted @ 2023-07-25 09:17 CJTARRR 阅读(7) 评论(0) 推荐(0) 编辑
摘要: git reset --hard idgit push -f 阅读全文
posted @ 2023-07-25 09:16 CJTARRR 阅读(2) 评论(0) 推荐(0) 编辑
  2023年7月11日
摘要: ele_handle = await page.xpath("xpath表达式") 此处的ele_handle是一个包含标签对象的列表。 通过上述方式得到的标签对象,也可以继续执行xpath,如:await ele_ele_handle[0].xpath("./div") 阅读全文
posted @ 2023-07-11 10:49 CJTARRR 阅读(227) 评论(0) 推荐(0) 编辑
  2023年7月10日
摘要: 解决:启用python环境编码为utf-8模式,输入这一句命令set PYTHONUTF8=1 阅读全文
posted @ 2023-07-10 11:51 CJTARRR 阅读(161) 评论(0) 推荐(0) 编辑
  2023年7月5日
摘要: 装饰器实现 def outer(func): """ 自定义逻辑1 """ def inner(*args,**kwargs): """ 自定义逻辑2 """ res = func(*args,**kwargs) """ 自定义逻辑3 """ return res return inner 装饰器装 阅读全文
posted @ 2023-07-05 00:08 CJTARRR 阅读(179) 评论(0) 推荐(0) 编辑
  2023年7月1日
摘要: 兼容windows和linux的终端执行函数 def shell_exec(cmd: str) -> str: """ 执行终端命令,输出终端打印结果 :param cmd: :return: """ with os.popen(cmd) as fp: bf = fp._stream.buffer. 阅读全文
posted @ 2023-07-01 09:04 CJTARRR 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 使用pip安装scrapy之后可能并不能直接运行,会遇到各种报错,可能是依赖库的版本不兼容导致的,可能需要安装或更新以下依赖: cryptography==38.0.4​pyopenssl==22.0.0​certifi==2023.5.7 在windows python3.8+下的scrapy框架 阅读全文
posted @ 2023-07-01 08:58 CJTARRR 阅读(28) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页