你已经会编程。
缺的不是 Python 课,
是一张翻译卡。
PyBridge 面向 Java / JavaScript / Go 开发者:每课双栏对照「你的写法 → Python 的写法」,讲完立刻在浏览器里运行。不教什么是变量,只教 「你的 HashMap 是 Python 的 dict」。
3 条路径 · 52 条概念映射 · 10 个迁移陷阱 · 浏览器内即跑,无需安装
对照卡 Nº 001 · HashMap → dict
Java
1Map<String, Integer> scores = new HashMap<>();2scores.put("ada", 96);3scores.put("lin", 88);4scores.put("kay", 92);56for (var e : scores.entrySet()) {7 System.out.println(8 e.getKey() + ": " + e.getValue());9}
Python
1scores = {"ada": 96, "lin": 88}2scores["kay"] = 9234for name, score in scores.items():5 print(f"{name}: {score}")67print("top:", max(scores, key=scores.get))
- 点右侧「运行」,右边的代码立刻在你的浏览器里跑起来 —— 不用装任何东西。
- 整个网站都是这个格式:左边你的语言,右边 Python,讲完就跑。
§ 01选择你的来路
三条路径,同一张 Python 地图01Java → Python把 Spring 的直觉翻译成 Python 的写法从工具链到 FastAPI,七张卡走完 Java 开发者最常卡住的地方:环境管理、推导式、dataclass、Protocol、异常与类型标注。7 课 · 约 105 分钟02JavaScript → Python从 npm 与 Promise 的世界,平移到 Python对 JS 开发者来说 Python 语法意外地熟悉:async/await 几乎同形。真正的差异在数据结构、工具链和「谁在替你做真并行」。4 课 · 约 50 分钟03Go → Python从 if err != nil 与 goroutine,走进异常与 asyncioGo 开发者的迁移最顺畅:显式错误处理对应异常,struct 对应 dataclass,隐式接口对应 Protocol。分歧点在并发模型与 GIL。4 课 · 约 50 分钟
§ 02概念映射词典
打开完整词典(52 条)→开发中卡住时来查:「我熟悉的 X,在 Python 里叫什么、地道写法长什么样」。
| 概念 | Java | JavaScript | Go | Python |
|---|---|---|---|---|
| 哈希表 | HashMap<K,V> | {} / Map | map[K]V | dict |
| 动态数组 | ArrayList<T> | Array | slice | list |
| 集合去重 | HashSet<T> | Set | map[T]struct{} | set |
| 不可变序列 | List.of(...) 的只读直觉 | — | 多返回值 | tuple |
| 纯数据载体 | record / Lombok @Value | 对象字面量 | struct | @dataclass |
| 枚举 | enum | const 对象 / TS enum | iota 常量块 | enum.Enum |
§ 03迁移陷阱精选
全部 10 条 →游乐场已经就绪。
无需注册、无需安装 —— Python 跑在你的浏览器里,60 秒出第一行输出。