上一页 1 2 3 4 5 6 7 8 ··· 19 下一页
摘要: 一、互斥锁 简介 互斥锁为资源引入一个状态:锁定/非锁定。 某个线程要更改共享数据时,先将其锁定,此时资源的状态为“锁定”,其他线程不能更改;直到该线程释放资源,将资源的状态变成“非锁定”,其他的线程才能再次锁定该资源。互斥锁保证了每次只有一个线程进行写入操作,从而保证了多线程情况下数据的正确性。 阅读全文
posted @ 2023-01-15 07:49 eliwang 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 字符串转unicode字符串技术要点: ord()函数 format()函数 代码: def str_to_unicode(string, upper=True): '''字符串转unicode''' if upper is True: return ''.join(rf'\u{ord(x):04X 阅读全文
posted @ 2023-01-14 04:31 eliwang 阅读(0) 评论(0) 推荐(0) 编辑
摘要: 相比于logging模块,loguru模块使用起来更方便,并且可以根据不同日志级别,进行不同颜色输出 一、安装 pip install loguru 二、基本使用 代码 from loguru import logger # logger.add(sys.stderr) 内部已默认执行,输出日志内容 阅读全文
posted @ 2023-01-13 23:40 eliwang 阅读(1130) 评论(0) 推荐(0) 编辑
摘要: 对于大多数图文验证码,均可以使用开源OCR识别库进行处理,比如ddddocr,接下来以ddddocr库进行示范 一、ddddocr库安装和使用 安装 pip install ddddocr 使用代码示例 import ddddocr ocr = ddddocr.DdddOcr(old=True) w 阅读全文
posted @ 2022-12-26 02:50 eliwang 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 一、创建对象的方式 字面量 let a = {} new关键字 let b = new Object() Object.create()方法 let c = Object.create(Object.prototype) 二、function、Function、prototype、construct 阅读全文
posted @ 2022-12-23 02:46 eliwang 阅读(649) 评论(0) 推荐(0) 编辑
摘要: 方式一:format() format(1.235, '.2f') Out[1]: '1.24' format(1.2, '.2f') Out[2]: '1.20' format(1.2, '.3f') Out[3]: '1.200' 返回值为字符串类型,末位会自动补0 方式二:round() ro 阅读全文
posted @ 2022-12-18 00:22 eliwang 阅读(1927) 评论(0) 推荐(0) 编辑
摘要: 一、介绍 docker容器是一种轻量级、可移植、自包含的软件打包技术,是一种应用程序,可以在几乎任何地方以相同的方式运行。 下载安装地址: https://hub.docker.com/ 修改默认安装路径(安装前操作) docker的默认安装路径为‘C:\Program Files\Docker’, 阅读全文
posted @ 2022-12-16 03:09 eliwang 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 转换方法: from datetime import datetime, timedelta def utc_to_local(utc_str, timezone=8): ''' utc时间转本地时间 :param utc_str: utc时间字符串 :param timezone: 时区(默认东八 阅读全文
posted @ 2022-12-10 19:37 eliwang 阅读(897) 评论(0) 推荐(0) 编辑
摘要: CSV文件,是按照逗号进行分隔的文件 一、写入操作 列表形式 逐行写入 import csv header = ['name', 'gender', 'age'] with open('./test.csv', 'w', encoding='utf-8-sig', newline='') as f: 阅读全文
posted @ 2022-12-09 05:10 eliwang 阅读(1016) 评论(0) 推荐(1) 编辑
摘要: 针对某些网站使用HTTP/2.0协议,requests库是无法抓取数据的,这时就需要使用支持HTTP2.0的请求库,比如httpx 一、安装 pip3 install httpx 二、常规API import httpx url = 'http://www.httpbin.org/get' head 阅读全文
posted @ 2022-12-08 22:27 eliwang 阅读(209) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 19 下一页