Library Search
结果页装饰器、生成器与上下文管理器
在 元器件 / 技术栈 / 知识库 中找到 14 个匹配结果。
技术栈
技术栈
6 个 MyBatis-Plus // 查询单个
User user = userMapper.selectOne(
new LambdaQueryWrapper<User>().eq(User::getEmail, "test@test.com")
);
// 只查指定字段
wrapper.select(User::getId, User::getName);
// 排除字段
wrapper.select(User.… 2% PaddlePaddle texts = ["这部电影太棒了!", "服务态度很差,不推荐。"]
inputs = tokenizer(texts, padding=True, return_tensors="pd")
logits = model(**inputs)
predictions = paddle.argmax(logits, axis=-1)
print(predictions) # [1, 0]
```… 2% KiCad - **封装库管理**:自定义封装单独放一个 `.pretty` 文件夹,便于团队共享
- **分层设计**:顶层只放页面符号和互联,子页面放具体电路
- **DRC 贯穿全流程**:原理图 ERC → 封装检查 → PCB DRC → 最后检查
- **制造文件**:Gerber + 钻孔 + BOM + 坐标文件 = 完整生产数据 1% Pillow # 保存
out_path = output_dir / f"processed_{filepath.stem}.jpg"
img.save(out_path, "JPEG", quality=85, optimize=True)
print(f"✓ {out_path}")
batch_process("./raw_pho… 1% Tailwind CSS <!-- 特性对比表 -->
<section class="max-w-3xl mx-auto mt-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4 text-center">断点系统</h2>
<div class="overflow-hidden rounded-xl border border-gray-200… 1% SQLite # 创建表
cursor.execute("""
CREATE TABLE IF NOT EXISTS students (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
score REAL,
grade TEXT GENERATED ALWAYS AS… 1%
知识库
知识库
8 个 装饰器、生成器与上下文管理器 # Python 进阶示例:装饰器、生成器与上下文管理器
## 目标
掌握 Python 三大进阶特性:**装饰器**、**生成器**、**上下文管理器**,理解它们在真实项目中的应用。
---
## 1. 装饰器(Decorator)
装饰器在不修改原函数的情况下,为其增加额外功能。
### 基础装饰器
```python
import time
import functools… 2% MyBatis-Plus 实战入门 // 查询单个
User user = userMapper.selectOne(
new LambdaQueryWrapper<User>().eq(User::getEmail, "test@test.com")
);
// 只查指定字段
wrapper.select(User::getId, User::getName);
// 排除字段
wrapper.select(User.… 2% 01-hello-world-基础语法 # ===== 7. 文件读写 =====
with open("demo.txt", "w", encoding="utf-8") as f:
f.write("Hello from Python!\n")
f.write(f"Generated by {name}\n")
with open("demo.txt", "r", encoding="utf-8") as f:… 2% 飞桨生态系统:ERNIE + 动静统一 + 产业套件 texts = ["这部电影太棒了!", "服务态度很差,不推荐。"]
inputs = tokenizer(texts, padding=True, return_tensors="pd")
logits = model(**inputs)
predictions = paddle.argmax(logits, axis=-1)
print(predictions) # [1, 0]
```… 1% 02-进阶工程化教程 ```python
# 类似列表推导式,但惰性求值
squares = (x**2 for x in range(10))
print(next(squares)) # 0
print(next(squares)) # 1
# 内存对比
import sys
list_comp = [x**2 for x in range(10_000)]
gen_exp = (x**2 for x in… 1% 进阶:自定义封装与分层原理图设计 # 钻孔文件
kicad-cli pcb export drill \
--output "$OUTDIR/" \
--format excellon \
--excellon-zeros-format decimal \
"$PROJECT.kicad_pcb"
# BOM
kicad-cli sch export bom \
--output "$OU… 1% Pillow 图像处理完全指南 # 保存
out_path = output_dir / f"processed_{filepath.stem}.jpg"
img.save(out_path, "JPEG", quality=85, optimize=True)
print(f"✓ {out_path}")
batch_process("./raw_pho… 1% 02-restful-api ```bash
# 获取所有书籍
curl http://localhost:5000/api/books
# 获取单本书
curl http://localhost:5000/api/books/1
# 创建新书
curl -X POST http://localhost:5000/api/books \
-H "Content-Type: application/json" \
-… 1%