Skip to content
🐍

Python 基础

15 个项目

15 个 Python 实战项目从猜数字游戏到数据处理工具,循序渐进地综合运用语法、函数与模块。

  1. 1

    数字 Guessing Game

    构建 command-行数字 guessing game in Python. computer 选取 secret 数字 and player guesses 直到它们获取它 正确, 使用 higher/lower hints.

    入门 约 15 分钟
  2. 2

    Temperature Converter

    构建设置的 Python 函数到 convert 之间 Celsius and Fahrenheit, plus command-行接口那个 uses 它们. 练习函数, 参数, and f-字符串.

    入门 约 10 分钟
  3. 3

    简单 Calculator (Python)

    构建 command-行 calculator in Python 那个 takes two 数字 and 运算符 and prints result. 练习函数, conditionals, and 错误 handling.

    简单 约 20 分钟
  4. 4

    文本计数器

    构建 Python script 那个数量 characters, words, and 行 in 块的 文本. 练习字符串方法, 拆分, and len().

    简单 约 15 分钟
  5. 5

    文本 Processor

    构建 Python 文本 processor 那个 cleans, transforms, and analyzes 文本. 练习字符串方法, 函数, and dictionaries.

    简单 约 20 分钟
  6. 6

    数据 Analyzer

    构建 Python 数据 analyzer 那个 computes statistics on 列表的 数字. 练习列表, 函数, and statistics 模块.

    简单 约 20 分钟
  7. 7

    File Manager

    构建 Python file manager 那个列表, 搜索, and 组织 files in directory. 练习 os 模块, file handling, and path 操作.

    中等 约 25 分钟
  8. 8

    简单 Web Scraper

    构建 Python web scraper 那个获取 web page and extracts 链接 and titles. 练习 urllib and re 模块, and 字符串处理.

    中等 约 25 分钟
  9. 9

    Todo 列表 Manager

    构建 Python todo 列表 manager using 类. 练习 OOP, 列表, and JSON serialization for 保存任务.

    中等 约 25 分钟
  10. 10

    密码 Generator

    构建 Python 密码 generator 使用 customizable 长度 and character 设置. 练习 random, 字符串模块, and 函数.

    简单 约 15 分钟
  11. 11

    函数装饰器

    编写为函数添加行为的 Python 装饰器——计时、日志和重试。练习 @ 语法、*args/**kwargs 和 functools.wraps。

    中等 约 35 分钟
  12. 12

    生成器与迭代器

    用 yield、生成器表达式和无限序列构建生成器。练习惰性求值和内存高效数据处理。

    中等 约 30 分钟
  13. 13

    上下文管理器

    用 __enter__/__exit__ 和 contextlib.contextmanager 装饰器构建上下文管理器。练习资源管理和 with 语句。

    中等 约 35 分钟
  14. 14

    数据类与命名元组

    用 @dataclass 和 NamedTuple 以更少样板建模结构化数据。练习字段默认值、类型提示和不可变性。

    中等 约 30 分钟
  15. 15

    插件架构

    使用 Python 的 importlib 和入口点设计插件系统。这是一个理解可扩展应用如何工作的开放性项目。

    中等 约 50 分钟