随笔分类 -  python

1 2 3 4 5 ··· 12 下一页
摘要:解决 pandas.to_csv 乱码、丢失行和自动换行问题-百度开发者中心 https://developer.baidu.com/article/details/2792989 在使用 pandas.to_csv 函数时,可能会遇到一些问题,如乱码、丢失行和自动换行等。这些问题通常是由于编码格式 阅读全文
posted @ 2025-09-18 17:04 papering 阅读(35) 评论(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 阅读(8) 评论(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 阅读(7) 评论(0) 推荐(0)
摘要:assert在Python优化模式(-O)下会被全局禁用 应改用显式的if/raise结构抛出业务异常(如ValueError) 翻译 搜索 复制 阅读全文
posted @ 2025-07-17 18:29 papering 阅读(9) 评论(0) 推荐(0)
摘要:import contextlibimport threadingimport timeclass TimeoutException(Exception): passdef raise_exception(): raise TimeoutException("Time out")@contextli 阅读全文
posted @ 2025-06-09 16:20 papering 阅读(9) 评论(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 阅读(6) 评论(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 阅读(14) 评论(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 阅读(6) 评论(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 阅读(20) 评论(0) 推荐(0)
摘要:s = 'abcaabc's = s.rstrip('abc') #!/usr/bin/python# -*- coding: UTF-8 -*- random_string = 'this is good ' # 字符串末尾的空格会被删除print(random_string.rstrip()) 阅读全文
posted @ 2024-08-12 14:22 papering 阅读(83) 评论(0) 推荐(0)
摘要:The Art of Graceful Reloading — uWSGI 2.0 documentation https://uwsgi-docs.readthedocs.io/en/latest/articles/TheArtOfGracefulReloading.html 翻译 搜索 复制 阅读全文
posted @ 2024-07-18 17:48 papering 阅读(11) 评论(0) 推荐(0)
摘要:如果 ensure_ascii 是 true (即默认值),输出保证将所有输入的非 ASCII 字符转义。如果 ensure_ascii 是 false,这些字符会原样输出。 If ensure_ascii is true (the default), the output is guarantee 阅读全文
posted @ 2024-07-12 19:12 papering 阅读(182) 评论(0) 推荐(0)
摘要:变量声明周期 内存释放 翻译 搜索 复制 阅读全文
posted @ 2024-07-11 10:30 papering 阅读(8) 评论(0) 推荐(0)
摘要:numpy判断 import numpy as np nan = float('nan') print(np.isnan(nan)) 翻译 搜索 复制 阅读全文
posted @ 2024-07-05 10:38 papering 阅读(11) 评论(0) 推荐(0)
摘要:Standard Library Types - Pydantic https://docs.pydantic.dev/2.7/api/standard_library_types/#typeddict from pydantic import BaseModelfrom typing import 阅读全文
posted @ 2024-05-30 14:23 papering 阅读(37) 评论(0) 推荐(0)
摘要:l=[{'a':45},{"b":34}]c=0for i in l: i['a']=c*100 c+=1 * 翻译 搜索 复制 阅读全文
posted @ 2024-05-23 20:16 papering 阅读(15) 评论(0) 推荐(0)
摘要:class Test: def __init__(self, totals, uniques, pre): self.totals = totals self.uniques = uniques self.cumulative_sum = totals if pre: self.cumulative 阅读全文
posted @ 2024-05-23 18:38 papering 阅读(6) 评论(0) 推荐(0)
摘要:MicroPython - Python for microcontrollers https://micropython.org/ 翻译 搜索 复制 阅读全文
posted @ 2023-11-29 12:34 papering 阅读(10) 评论(0) 推荐(0)
摘要:print 翻译 搜索 复制 阅读全文
posted @ 2023-08-09 09:58 papering 阅读(20) 评论(0) 推荐(0)
摘要:in-memory analytics Apache Arrow Apache Arrow is a development platform for in-memory analytics. It contains a set of technologies that enable big dat 阅读全文
posted @ 2023-08-02 16:43 papering 阅读(41) 评论(0) 推荐(0)

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