随笔分类 -  python

1 2 3 4 5 ··· 13 下一页
摘要:\py385\DLLs\select.pyd# by generator 1.147"""This module supports asynchronous I/O on multiple file descriptors.*** IMPORTANT NOTICE ***On Windows, on 阅读全文
posted @ 2026-07-22 20:51 papering 阅读(2) 评论(0) 推荐(0)
摘要:contextlib — Utilities for with-statement contexts — Python 3.14.6 documentation def contextmanager(func): """@contextmanager decorator. Typical usage 阅读全文
posted @ 2026-07-08 19:59 papering 阅读(3) 评论(0) 推荐(0)
摘要:_LOGGER_EXPORTS = { "db_logger": "db", "web_logger": "web", } def __getattr__(name: str) -> logging.Logger: logger_name = _LOGGER_EXPORTS.get(name) if 阅读全文
posted @ 2026-07-06 20:05 papering 阅读(3) 评论(0) 推荐(0)
摘要:py385\Lib\json\__init__.py def write_json_file( file_path: Union[str, Path], data: Any, encoding: str = 'utf-8', indent: int = 2, ensure_ascii: bool = 阅读全文
posted @ 2026-06-27 10:49 papering 阅读(4) 评论(0) 推荐(0)
摘要:某个位置的字符被替换成了视觉上相同、但底层编码不同的字符 全角(Full-width):每个字符占用两个标准字符位置,常用于中文标点、汉字以及部分英文字符和符号。全角字符在视觉上更宽,适合中文排版,保证文字对齐整齐。半角(Half-width):每个字符占用一个标准字符位置,主要用于英文字符、数字和 阅读全文
posted @ 2026-06-27 09:58 papering 阅读(21) 评论(0) 推荐(0)
摘要:PyInstaller Advanced Topics — PyInstaller 6.20.0 documentation importlib import 的实现 — Python 3.14.6 文档 实现延迟导入 以下例子展示了如何实现延迟导入: import importlib.util i 阅读全文
posted @ 2026-06-13 10:43 papering 阅读(8) 评论(0) 推荐(0)
摘要:Python 中双下划线会触发名称修饰(mangling),通常用于避免子类覆盖, 阅读全文
posted @ 2026-05-28 11:28 papering 阅读(11) 评论(0) 推荐(0)
摘要:1、 python -m venv --copies .venv 把 Python 本地完整地复制一份到 .venv 文件夹里。 然后,进入venv环境,安装 pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/sim 阅读全文
posted @ 2026-05-12 11:37 papering 阅读(16) 评论(0) 推荐(0)
摘要:python a={'a':123}b={'b':456}a['x']=bprint(a)b={'b':789}print(a) {'a': 123, 'x': {'b': 456}}{'a': 123, 'x': {'b': 456}} lua local a={} a['a']=123 loca 阅读全文
posted @ 2026-01-12 17:22 papering 阅读(30) 评论(0) 推荐(0)
摘要:strip error · Issue #143185 · python/cpython https://github.com/python/cpython/issues/143185 s = 'bytedance_advertiser'.rstrip('_advertiser')s1 = 'ten 阅读全文
posted @ 2025-12-26 11:22 papering 阅读(22) 评论(0) 推荐(0)
摘要:def _gzip_string(data): try: return gzip.compress(data) except AttributeError: import StringIO buf = StringIO.StringIO() fd = gzip.GzipFile(fileobj=bu 阅读全文
posted @ 2025-11-07 15:11 papering 阅读(12) 评论(0) 推荐(0)
摘要:解决 pandas.to_csv 乱码、丢失行和自动换行问题-百度开发者中心 https://developer.baidu.com/article/details/2792989 在使用 pandas.to_csv 函数时,可能会遇到一些问题,如乱码、丢失行和自动换行等。这些问题通常是由于编码格式 阅读全文
posted @ 2025-09-18 17:04 papering 阅读(149) 评论(0) 推荐(0)
摘要:s = ''' [ { label: "苹果", value: "origin_event_data", icon: "icon-a", color: "#409EFF", bgColor: "#ECF5FF", borderColor: "#D9ECFF", }, { label: "橘子", v 阅读全文
posted @ 2025-09-18 10:25 papering 阅读(34) 评论(0) 推荐(0)
摘要:Generics — typing documentation https://typing.python.org/en/latest/reference/generics.html You may have seen type hints like list[str] or dict[str, i 阅读全文
posted @ 2025-09-11 10:50 papering 阅读(14) 评论(0) 推荐(0)
摘要:assert在Python优化模式(-O)下会被全局禁用 应改用显式的if/raise结构抛出业务异常(如ValueError) 翻译 搜索 复制 阅读全文
posted @ 2025-07-17 18:29 papering 阅读(19) 评论(0) 推荐(0)
摘要:import contextlibimport threadingimport timeclass TimeoutException(Exception): passdef raise_exception(): raise TimeoutException("Time out")@contextli 阅读全文
posted @ 2025-06-09 16:20 papering 阅读(24) 评论(0) 推荐(0)
摘要:Python 类变动的钩子方法 from typing import Listclass Field: def __init__(self, name, is_user=False): self.name = name self.is_user = is_user def __str__(self) 阅读全文
posted @ 2024-09-05 18:18 papering 阅读(27) 评论(0) 推荐(0)
摘要:isort https://pycqa.github.io/isort/ isort · PyPI https://pypi.org/project/isort/ Before isort: from my_lib import Object import os from my_lib import 阅读全文
posted @ 2024-08-29 11:26 papering 阅读(35) 评论(0) 推荐(0)
摘要:实践: 测试用例 @dataclasses.dataclassclass TestCase: method: str path: str cid: int data: dict query_str: str resp: dict = dataclasses.field(default_factory 阅读全文
posted @ 2024-08-28 14:42 papering 阅读(28) 评论(0) 推荐(0)
摘要:def defer(msg: str, subject='参数错误'): print('do ') return f'{subject}:{msg}'assert False, defer('66') Python 实现类似于Go语言中的延迟执行语句(defer)|极客笔记 https://deep 阅读全文
posted @ 2024-08-27 17:42 papering 阅读(52) 评论(0) 推荐(0)

1 2 3 4 5 ··· 13 下一页