python3-cookbook icon indicating copy to clipboard operation
python3-cookbook copied to clipboard

《Python Cookbook》 3rd Edition Translation

Results 70 python3-cookbook issues
Sort by recently updated
recently updated
newest added

在[10.3 使用相对路径名导入包中子模块](https://github.com/yidao620c/python3-cookbook/blob/master/source/c10/p03_import_submodules_by_relative_names.rst#讨论)中,有: > import语句的 . 和 .. 看起来很滑稽, 但它指定目录名.为当前目录,..B为目录../B。这种语法只适用于import 此处句子最后的「只适用于import」应更正为「只适用于from形式的import」,英文原文为: > The . and .. syntax on the import statement might look funny, but think of it as specifying a...

import speech_recognition as sr def take_command(): r = sr.Recognizer() with sr.Microphone() as source: print("Listening...") audio = r.listen(source) try: command = r.recognize_google(audio).lower() print("You said: " + command) except sr.UnknownValueError: print("Sorry, I...

这个 PR 给 README 排版。 因为原来的 README 没有遵循[排版原则](https://github.com/sparanoid/chinese-copywriting-guidelines),于是提了这个修改: - Python 首字母要大写 - "Python 3":Python 和 3 之间有空格(可参考 Python 官网的写法) - Read the Docs 三个词之间要空格(可参考官网的写法) - 有两处语病 - 中英文之间要添加空格

讨论的部分: “或许配置文件和Python代码最大的不同在于,它并不是从上而下的顺序执行。 文件是安装一个整体被读取的。” 似乎应该是 “或许配置文件和Python代码最大的不同在于,它并不是从上而下的顺序执行。 文件是按照一个整体被读取的。”

第一章中的笔误: - 1.7标题翻译为“有序字典”可能更合适些,原文中为“Keeping Dictionaries in Order”,这应该是指按照插入顺序有序的意思,而不是排序的含义; - 1.17最下面一行(即39页最后一行)中,`dict`误写为`dcit`了; - 1.19“问题”部分最后面丢失了句号。

Python3.5以后使用 html.unescape(s)

Err: '%{name}s has %{n} messages.' % vars() OK: '%{name}s has %{n}d messages.' % vars()

位置: - 8.13小节 使用类装饰器案例 - pdf 270 页 当前原文: ```python # Example @check_attributes(name=SizedString(size=8), shares=UnsignedInteger, price=UnsignedFloat) class Stock: def __init__(self, name, shares, price): self.name = name self.shares = shares self.price =...